Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: How to write the perl script for the following linux command?

by Corion (Patriarch)
on Mar 14, 2017 at 11:41 UTC ( [id://1184534]=note: print w/replies, xml ) Need Help??


in reply to How to write the perl script for the following linux command?

Can you please also describe in English what this command is supposed to do?

Most likely, File::Find and File::Copy implement most of the functionality you will need.

  • Comment on Re: How to write the perl script for the following linux command?

Replies are listed 'Best First'.
Re^2: How to write the perl script for the following linux command?
by finddata (Sexton) on Mar 14, 2017 at 12:14 UTC
    The above command will find the source location and fetches for (*.csv files) and store the same directory structure at destination.

      So, what Perl code did you write, for example using the modules I mentioned already, and how does it fail to do what you need?

        my $sorce_direcrtory = $input_dir; my $new_directory = $output_dir; opendir(my $dh, $sorce_direcrtory) || die; while(readdir $dh) { if($_ =~ /.csv/){ copy("$sorce_direcrtory/$_", "$new_directory/$_"); } } closedir $dh;
        error: Use of uninitialized value in pattern match (m//)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2024-04-25 16:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found