Renaming non-ascii filesby jon12 (Novice)
|on Jun 01, 2005 at 10:35 UTC ( #462384=perlquestion: print w/replies, xml )||Need Help??|
jon12 has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to get some clarity on Perl's ability to rename non-ascii files. I would like to rename only non-ascii files in a directory that contains ascii and non-ascii filenames.
However, I am finding that with the standard Perl rename(oldfilename, newfilename) I recieve a "Permission Denied at <STDIN> line xxx" where xxx is the line containing the rename command. This error only appears when Perl attempts to rename a non-ascii filename.
Using the bactick rename: `rename \"oldfilename\" \"newfilename\"` the program seems to work with the caveat that Perl sees the non-ascii filenames as question marks ????? ????? and seems to find multiple duplicates and cannot rename all found. Error: Duplicate filename or file cannot be found.
Here is my code, I have many versions but this is my latest:
Build: Active Perl v5.8.4
System: Windows XP Pro
Is there a better way to achieve the renaming of files, as neither of these methods are effective?
Thanks in advance.
Back to Seekers of Perl Wisdom