Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
#!/perl/bin/perl -w use strict; # Open 'find' process to list files recursively with paths #my $path_to_dir = shift; print "Opening Directory\n"; my $path_to_dir = "c:/progra~1/apache~1/apache2/htdocs/test"; dir("$path_to_dir"); sub dir { opendir(DIR,"$_[0]"); my @list_of_files = readdir(DIR); foreach(@list_of_files) { print "BEFORE: $_\n"; if($_ ne "." && $_ ne "..") { if(-d "$_[0]/$_") { dir("$_[0]/$_"); } else { $_ =~ s/\ /_/ig; rename "$_[0]/$_","$_[0]/\L$_"; print "AFTER: $_[0]/$_,$_[0]/\L$_\n\n"; } } } } ##### print "\n\nDone!... ;-)";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Renaming Not Working
by davido (Cardinal) on Aug 18, 2005 at 15:51 UTC | |
|
Re: Renaming Not Working
by duff (Parson) on Aug 18, 2005 at 15:50 UTC | |
by inman (Curate) on Aug 18, 2005 at 15:58 UTC | |
|
Re: Renaming Not Working
by NateTut (Deacon) on Aug 18, 2005 at 15:53 UTC |