cormanaz has asked for the wisdom of the Perl Monks concerning the following question:
I started by writing a script to stat the existing files like so
This works for most of the pdfs, but others have filenames with odd characters (commas, hyphens, colons, parens, underscores; part of the reason they need renaming), and aren't being recognized by stat even though they exist in the directory.use strict; my $workdir = "C:/work"; open(IN,"pdffix.txt") or die "Can't open input: $!\n"; while(<IN>) { chomp; my ($folder,$newfn,$pdfn) = split(/\t/); $pdfn =~ s/^\"|\"$//g; my $filename = "$workdir/$folder/$pdfn"; unless (-e $filename) { print "can't find $folder $pdfn\n"; } }
Presumably I won't be able to rename a file I can't stat, so how do I properly specify these odd filenames?
Thanks
Steve
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Handling windoze filenames with odd charactters
by ciderpunx (Vicar) on Feb 20, 2011 at 18:16 UTC | |
|
Re: Handling windoze filenames with odd charactters
by chrestomanci (Priest) on Feb 20, 2011 at 18:29 UTC | |
by Anonymous Monk on Feb 21, 2011 at 02:33 UTC | |
by chrestomanci (Priest) on Feb 21, 2011 at 10:41 UTC | |
by Anonymous Monk on Feb 21, 2011 at 10:57 UTC | |
by Anonymous Monk on Feb 21, 2011 at 10:59 UTC | |
|
Re: Handling windoze filenames with odd charactters
by cormanaz (Deacon) on Feb 20, 2011 at 21:17 UTC |