Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: moving files

by 2teez (Priest)
on Oct 16, 2012 at 08:17 UTC ( #999254=note: print w/ replies, xml ) Need Help??


in reply to moving files

You could use File::Copy with File::Find instead of

system ("mv $fil_nm ./reports")
like so:
use warnings; use strict; use File::Copy qw(move); use File::Spec; use Cwd qw(abs_path); use File::Find; my $path = $ARGV[0]; my $final_dir = File::Spec->rel2abs("./report"); $path = abs_path($path); find( sub { chomp; return if $_ eq '.' or $_ eq '..'; move( $_, $final_dir ); }, $path );

If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me


Comment on Re: moving files
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (12)
As of 2014-10-20 09:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (74 votes), past polls