Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: writtings files to a new folder

by siva kumar (Pilgrim)
on Jan 24, 2007 at 09:12 UTC ( [id://596219]=note: print w/replies, xml ) Need Help??


in reply to writtings files to a new folder

Hope below code may help you.
Create the directory 'new' before running the script.
#!/usr/bin/perl use strict; use File::Copy; my @files = ('one.txt','two.txt','three.txt'); for my $file (@files) { if (-f "old/$file") { print "old/$file moved to new/$file\n" ; copy("old/$file", "new/.") or die "Error Coping /old/$file: $! +"; } }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://596219]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (4)
As of 2024-03-29 06:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found