Jakob Kofoed wrote:
I used find2perl to get the syntax of File::Find:
<snip>
sub wanted {
print("$name\n");
}
Which gives me the result I want - printed to STDOUT - but to
change this to handle every file/folder (and get the top folder
name for renaming) is what I hoped some of you could "hint" me
with.
Okay. So, obviously you'd better change the wanted() function, right?
I think I would have wanted() store the paths in an array instead of
printing them.
perldoc -f unshift
To exclude those paths you don't want to change, you can do for instance:
unless ($name =~ /\.dat$/ or $name eq $ARGV[0]) {
unshift @paths, $name;
}
Then I would loop through @paths and rename the paths.
perldoc -f rename
You may find the File::Basename and File::Spec modules useful.
Time for you to give it a serious try? I think so. Please feel free to
ask for help if you encounter any specific difficulties.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>