3 ms·
CentOS 7 specifies `man rename` : rename [options] expression replacement file... The rename example fails with "rename: not enough arguments".
by cutler 9y ago
CentOS 7 specifies `man rename` :
rename [options] expression replacement file...
The rename example fails with "rename: not enough arguments".
- jwilk 9y agoUnfortunately, there are two incompatible rename programs in the wild. :( Debian ships this: https://metacpan.org/pod/distribution/File-Rename/rename.PL https://metacpan.org/pod/distribution/File-Rename/rename.PL Most(?) other distros ship the one from util-linux: http://man7.org/linux/man-pages/man1/rename.1.html http://man7.org/linux/man-pages/man1/rename.1.html
- loudmax 9y agoDon't read it like this: rename <expression> <replacement file> ... Read it like this: rename <expression> <replacement> <file(s)...> Argument 1 is a string (not a regex), argument 2 is string to replace the old string, and arguments 3+ is a file, or list of files, or a glob. The man page includes a warning about the lack of safeguards. It is unfortunate that rename doesn't have an equivalent of mv or cp's -i flag because it's so easy to overwrite files if your expressions aren't exactly correct. On some Ubuntu systems, I've seen another version of rename that's actually a Perl script that uses regular expressions. I think that version lets you set some safeguards, which are sorely lacking in the binary version of rename that ships with CentOS.
- wyoh 9y agoIt's available in Fedora under the name "prename". I've asked the maintener to make it available for EPEL 7, will this work for you?