I have a directory tree like this
.
|-- players
| |-- red_alice.plr
| |-- red_bob.plr
|-- resources
| |-- red_cash.rsc
| |-- red_food.rsc
I want to go through all directories and rename any file that starts with "red" to instead start with "blue"...
I think it is work of find and sed commands but I am not sure how to formulate this situation...I know for example I can find files by
find . -name "red*" -type f
then how to use this output to rename red to blue?
find path_to_dir/ -type f -name 'red_*' -exec sh -c 'for f; do echo mv -- "$f" "${f/red/blue}"; done' _ {} +When satisfied, remove theechopart