How to rename recursively files in all the filesystem
The simplest method that I have found to rename recursively a group of file is to use the "rename" linux bash command with a simple perl regular expression.
To rename all the file with extension containing the word "foo" I can use the following command:
$ rename s/foo/dog/ *foo*
To rename all the files with ".txt" extension you only need to specify *.txt instead of *foo*, as shown in the following example:
$ rename s/foo/dog/ *.txt
The real problem occurs when you want to change recursively the file name into multiple directory and sub directory.
I usually use this simple bash script to accomplish this task:
- "rename" command rename all file matching a rule (2th argument) into the current directory
- "rename" 2th argument is the file typology and not a directory
Enjoy your Linux!
0 Responses to "Linux - Rename files":
Posta un commento