Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^3: How to prefix a string to all the files in a directories as well subdirectories

by cdarke (Prior)
on Dec 30, 2008 at 10:53 UTC ( #733225=note: print w/replies, xml ) Need Help??


in reply to Re^2: How to prefix a string to all the files in a directories as well subdirectories
in thread How to prefix a string to all the files in a directories as well subdirectories

Like this:
#!/usr/bin/perl use strict; use warnings; use File::Find; sub callback { my $file = $_; rename $file,"reference_$file" if -f $file } my $dir = 'C:/Image_Repository'; find (\&callback, $dir);
Of course, there is always More Than One Way To Do It, so you can "hand craft" it if you enjoy lots of typing, but it probably won't be as efficient as using File::Find.
  • Comment on Re^3: How to prefix a string to all the files in a directories as well subdirectories
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://733225]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2017-11-19 00:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (278 votes). Check out past polls.

    Notices?