Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

RE: Re: help moving files

by Odud (Pilgrim)
on Jun 29, 2000 at 00:04 UTC ( [id://20244]=note: print w/replies, xml ) Need Help??


in reply to Re: help moving files
in thread help moving files

The following is some hastily bashed together code to show what I mean. It works for me but you should add error handling etc.
#!/usr/bin/perl use warnings; use File::Copy; use File::Find; find(\&wanted, 'c:\\Pete'); sub wanted { if ($File::Find::name =~ /\.pl$/) { my $copyname = "c:\\folderb/$_"; print "Copying $_ from $File::Find::dir to $copyname\n"; copy("$File::Find::name","$copyname"); } }
It finds all the .pl files in c:\Pete and sub-directories and copies them into c:\folderb.

Look at the documentation to find out about the special variables that are available to the subroutine.

Hope this helps.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2024-04-19 19:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found