Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
The only problem is it won't work for files with spaces in the name - the '@ARGV = map glob ...' line uses the space as a delimiter and assumes eg 'file1 .txt' is refering to two files : 'file1' and '.txt'.use File::Find::Rule; my $root_in = "E:/PGPTool/dept/AIS/dropbox"; aprint "Before:\n"; foreach (@ARGV) { print "$_\n"; } # replace wildcards and directories in @ARGV with actual files/folders @ARGV = map glob ("$root_in/$_"), @ARGV; eval { @ARGV = find (file => in => \@ARGV) }; foreach (@ARGV) { $_ =~ s/($root_in\/)(.+)/$2/; } print "\nAfter:\n"; foreach (@ARGV) { print "$_\n"; }
which fixes the problem, but brakes it for files which do not contain spaces.glob ("'$root_in/$_'"), @ARGV;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Replacing specified files with actual files using map glob (modules)
by tye (Sage) on Apr 06, 2004 at 15:59 UTC | |
|
Re: Replacing specified files with actual files using map glob
by Anonymous Monk on Apr 06, 2004 at 17:05 UTC |