How can I rename .jpg files in multiple folders based on the name of the folder? I also want the
.jpg files to remain in their respective folders and not moved. The folder names have no spaces.
So, for example, if the folder name is Red, then I want the resulting file names to be:
Red000001.jpg Red000002.jpg Red000003.jpg
I have the following command, but it gives undesirable results, moving renamed files outside of their respective folders and making the file names "sloppy":
start=$PWD; for directory in *; do cd "$directory"; for filename in *; do mv "$filename" ../"Folder $directory - $filename"; done; cd "$start"; done