prename directoy fix
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
perl (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
Binary package hint: perl
Hi,
I like to use find and perl's rename utility to massively rename files. However prename also applies the supplied regular expression to the whole path not just the filename part, although it obviously cannot rename the directory part. Here's an example:
% /usr/bin/rename -n 's/A/a/' dirA/fileA
dirA/fileA renamed as dira/fileA
% /usr/bin/rename -n 's/A/a/g' dirA/fileA
dirA/fileA renamed as dira/filea
Both examples would fail without -n. Instead, it should better work like this, only applying the regex to the filename part:
% local/scripts/
dirA/fileA renamed as dirA/filea
% local/scripts/
dirA/fileA renamed as dirA/filea
Although, I know it is possible to write regular expressions that work this way, it is difficult to get it right and more difficult to use this tool. A patch has been attached.
for reference:
# lsb_release -rd
Description: Ubuntu 9.04
Release: 9.04
# apt-cache policy perl
perl:
Installed: 5.10.0-19ubuntu1.1
Candidate: 5.10.0-19ubuntu1.1
Version table:
5.
1 http://
*** 5.10.0-19ubuntu1.1 0
500 http://
500 http://
100 /var/lib/
5.
500 http://
I think the current behaviour is what's must intuitive even if the move might fail. Further applying the patch would break backwards capability.
Perhaps you could add another command line switch to enable this functionality? Then could you open a bug against Debian (here: http:// bugs.debian. org/cgi- bin/pkgreport. cgi?package= perl) with the amended patch to see whether the Maintainer there will accept it.