JKasting has asked for the wisdom of the Perl Monks concerning the following question:
It's moving most of the files into the folders perfectly, however, some are not getting moved at all. If I put a die command on the move function, it quits when I get to one it won't move. Any ideas on why it is not working?$dir = getcwd(); find(\&book, $dir ."/Book Chapter"); my @bookFiles; sub book{ next if (-l && !-e ); push (@bookFiles, $File::Find::name) if (( $_ =~ m/\.txt$/) || ($_ + =~ m/\.jpg$/) || ($_=~ m/\.tif$/)); } my @bookNameArray; my $bookName; my @bookFileName; for(my $h = 0; $h < scalar(@bookFiles); $h++){ @bookNameArray = split(/_/ , $bookFiles[$h]); @bookFileName = split("/" , $bookFiles[$h]); $bookName = $bookNameArray[-2]; mkdir( $dir . "/Book Chapter/" . $bookName); move($bookFiles[$h], $dir . "/Book Chapter/" . $bookName . "/" . $b +ookFileName[-1]); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: move() error
by toolic (Bishop) on Feb 26, 2010 at 17:56 UTC | |
by JKasting (Novice) on Feb 26, 2010 at 18:25 UTC | |
by toolic (Bishop) on Feb 26, 2010 at 18:52 UTC | |
by JKasting (Novice) on Feb 27, 2010 at 21:08 UTC | |
by almut (Canon) on Feb 27, 2010 at 23:23 UTC | |
by Anonymous Monk on Feb 28, 2010 at 02:08 UTC | |
by Anonymous Monk on Feb 26, 2010 at 18:29 UTC | |
|
Re: move() error
by almut (Canon) on Feb 26, 2010 at 17:55 UTC | |
|
Re: move() error
by pileofrogs (Priest) on Feb 26, 2010 at 19:52 UTC |