Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: rename doesn't work on OSX?

by vitoco (Friar)
on Dec 10, 2009 at 11:59 UTC ( #812169=note: print w/replies, xml ) Need Help??


in reply to rename doesn't work on OSX?

File path is missing from parameters. Try:

my $dir = "kennel"; opendir(DIR,$dir) or die "Cannot read $dir\n"; while ($file = readdir(DIR)) { next unless $file =~ /cat/; my $newfile = $file; $newfile =~ s/cat/dog/; rename("$dir/$file", "$dir/$newfile") || print "Don't have permiss +ion to rename.\n"; } closedir(DIR);

Replies are listed 'Best First'.
Re^2: rename doesn't work on OSX?
by mmfuller (Initiate) on Dec 10, 2009 at 15:14 UTC

    @vitoco and @ikegami -- the file path! Right! It's usually the simplest little things that trip me up!

    Thank you!!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://812169]
help
Chatterbox?
[ambrus]: So that, or if you really want something agnostic to the loop, then use curl multi. Its interface is quite reasonable (unless you use an old version),
[ambrus]: though it's very C-like (serious use of varargs so easy to pass the wrong type), and there are some minor problems (busy loop because it doesn't use the same timer as your event loop, so you have to artificially delay timer callbacks by a small amount).

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (13)
As of 2016-12-07 16:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (130 votes). Check out past polls.