I currently have 2000 user directories and each of these directories have sub directories.
user_1
---> child1
---> child2
user_29
---> child37
---> child56
etc
I need to loop through all of the user folders and then through each of the child folders and rename the child folders with a prefix 'album_'. My end structure should be:
user_1
---> album_child1
---> album_child2
user_29
---> album_child37
---> album_child56
I was able to rename the user folders with the following command:
for f in * ; do mv "$f" user_"$f" ; done;
I have been trying several different approaches to rename the sub directories such as:
find . -maxdepth 2 -mindepth 2 -type d -exec mv '{}' album_'{}'
The first part of the above query returns all the directories that I need to rename ('find . -maxdepth 2 -mindepth 2 -type d').
How do I access the directory name in the -exec function and then append a prefix to it?