You can use the rename
command to rename multiple folders in Linux using the command line. The rename
command is a Perl-based utility that allows you to rename multiple files based on a regular expression.
Here’s an example of how to use the rename
command to rename all folders that have the name “old_folder” to “new_folder”:
rename 's/old_folder/new_folder/' *
This command will rename all folders that have the name “old_folder” to “new_folder” in the current directory. If you want to rename folders recursively in all subdirectories, you can use the -R option:
rename -R 's/old_folder/new_folder/' *
You can also use the mv
command to rename multiple folders in Linux. This command will move the folder to a new location.
mv old_folder* new_folder/
You can also use find
command with -exec
option to rename all folders that contain a specific word:
find . -type d -name "*old*" -execdir mv {} new_{} \;
It is important to note that, using the rename
command or find
command with -exec
option will rename the folders and the files in them, and also the command is irreversible. So, it’s recommended to take a backup of your data before using it.