You may need to rename several files in a folder following a pattern.
Say you have
1 | jmiguel@monk /tmp/a $ touch file.1.txt |
And you want to get
1 | -rw-r--r-- 1 jmiguel jmiguel 0 jun 19 10:54 newname.1.txt |
You can do a loop, string substitution… a mess. Or you can use the rename
command in this way:
rename 's/file/newname/g' *
Note than rename is a shell script made with perl, so maybe it’s not available on your operating system (mint and ubuntu have it) but if you have perl you can just copy and paste de following code to create your own rename
version.
1 | # |