Viki@Stag has asked for the wisdom of the Perl Monks concerning the following question:
THe actually reads a file that has list of paths, scans each path & renames files that has certain extension to .bakuse File::Find; open(INLIST, $ARGV[0]) or die "cannot open $ARGV[0]: $!\n"; my @all_paths = <INLIST>; close INLIST; chomp @all_paths; foreach my $path(@all_paths) { if (-f $path && $path=~/\.dirlist$/){ open (LIST, $path) or do { print "cannot open $path: $!\n"; n +ext; }; my @temp = <LIST>; chomp @temp; push @all_paths, @temp; close LIST; next; } elsif (-d $path) { find(\&scan_path_n_rename_file, $path); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How & why does this work?
by almut (Canon) on Jul 11, 2008 at 13:33 UTC | |
by kyle (Abbot) on Jul 11, 2008 at 14:07 UTC | |
by Viki@Stag (Sexton) on Jul 11, 2008 at 14:17 UTC | |
by almut (Canon) on Jul 11, 2008 at 14:30 UTC |