Recursive renaming
simonc edited this page Sep 13, 2010
·
2 revisions
The -R
option is used to activate the recursive mode.
Given the following tree :
./ |-- dir_1/ | |-- dir_11/ | | |-- dir_111/ | | |-- dir_112/ | | |-- file_111 | | `-- file_112 | |-- file_11 | `-- file_12 |-- file_1 `-- file_2
The following command will rename all the file in the tree :
absrenamer -R -f"&" .
The result will be :
./ |-- dir_1/ | |-- dir_11/ | | |-- dir_111/ | | |-- dir_112/ | | |-- FILE_111 | | `-- FILE_112 | |-- FILE_11 | `-- FILE_12 |-- FILE_1 `-- FILE_2
The --maxdepth
option can be used to set the recursion depth :
absrenamer -R --maxdepth 2 -f"*" .
The resulting tree will be :
./ |-- dir_1/ | |-- dir_11/ | | |-- dir_111/ | | |-- dir_112/ | | |-- FILE_111 | | `-- FILE_112 | |-- File_11 | `-- File_12 |-- File_1 `-- File_2
When directories are renamed recursively (by combining the -R
and -d
options) the deepest directories are renamed first to avoid the following case :
mv dir_1 Folder_1 mv dir_1/dir_11 dir_1/Folder_11
What is done by AbsoluteRenamer is :
mv dir_1/dir_11 dir_1/Folder_11 mv dir_1 Folder_1