Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
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 wandering the Monastery: (5)
As of 2018-01-17 03:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How did you see in the new year?










    Results (196 votes). Check out past polls.

    Notices?