Skip Menu |

This queue is for tickets about the File-Rename CPAN distribution.

Report information
The Basics
Id: 124422
Status: resolved
Priority: 0/
Queue: File-Rename

People
Owner: Nobody in particular
Requestors: cas [...] taz.net.au
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 0.30



Subject: File::Rename can't rename filenames containing newlines
Date: Wed, 14 Feb 2018 10:02:50 +1100
To: bug-File-Rename [...] rt.cpan.org
From: Craig Sanders <cas [...] taz.net.au>
newlines are an annoying but valid character in filenames. File::Rename doesn't cope with them. For example: $ touch $'foo\nbar.text' $ find . -name '*.text' | rename 's/\.text$/.txt/' Can't rename bar.text bar.txt: No such file or directory rename should either have a `-0` option (e.g. for taking -print0 input from find) or File::Rename should auto-detect that the input contains NUL characters and set $/="\0" BTW, a current workaround is to run rename with 'perl -0': $ find . -name '*.text' -print0 | perl -0 /usr/bin/rename -v 's/\.text$/.txt/' Reading filenames from file handle (GLOB(0x555555976808)) ./foo bar.text renamed as ./foo bar.txt Thanks, craig
Subject: Re: [rt.cpan.org #124422] AutoReply: File::Rename can't rename filenames containing newlines
Date: Wed, 14 Feb 2018 13:09:43 +1100
To: Bugs in File-Rename via RT <bug-File-Rename [...] rt.cpan.org>
From: Craig Sanders <cas [...] taz.net.au>
I should have been more precise with this bug report. This is only a problem when the filenames are read from stdin, not when they're args on the command line. another "workaround" is: find . -name '*.text' -exec rename 's/\.text/.txt/' {} + craig