in reply to Re: elseif syntax error
in thread elseif syntax error
Can't cd to (./test/) test test test test: No such file or directory at e:\path\myfiles\perl\filename_spaces2.pl line 7
The code is fine it is not completely "recursive" someone of you got some hint how to go down in every subdirectory?
If i start it a second time it is working ...
On first attempt the directory tree is (i got several space containing files below E:\temp:
The result is:#Perl should find spaces and replace them with "-" # use warnings; use File::Copy; use File::Find; find(\&rename_txts, "."); #Pfade ... find(\&rename_txts, "./txt2/"); sub rename_txts { if (!/^\.+$/) { my $new_name = $_; $new_name =~ y/ /-/; print "$File::Find::name to $new_name\n"; print "$_ \n"; move $_, $new_name; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: elseif syntax error
by gmargo (Hermit) on Oct 27, 2009 at 16:07 UTC |