Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
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?
[erix]: yeah. it's been some time since I last built a (linux) kernel but perl takes less than 30s and postgresql less than 2 minutes minutes :)
[talexb]: Yep .. came across SuSE 6.2 in my storage locker recently. How old is that.
[erix]: 2001 :)
[erix]: (I have the wp pages open :))
[talexb]: 2001 sounds about right .. got myself a separate box just to run Linux on. Seriously clueless.

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (10)
As of 2018-07-17 17:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (374 votes). Check out past polls.

    Notices?