File Copy Perl


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting File Copy Perl
# 1  
Old 03-29-2011
File Copy Perl

Hi

Could you please help me on this

I have folder called D:\Data in which we have 20 files coming daily and needed all 20 files to copy into D:\Target ,as i am new to PERL, i did nt know how to use this

I googled sme of the code and done the copy script,it is throwing error like we do install File::NCopy module to perform this

Code:
#!/usr/bin/perl
    use strict;
    use warnings;
    use File::NCopy;

    my $source_dir  = "D://data";
    my $target_dir  = "D://target";

    mkdir($target_dir) or die "Could not mkdir $target_dir: $!";

    my $cp = File::NCopy->new(recursive => 1);
    $cp->copy("$source_dir/*", $target_dir) 
        or die "Could not perform rcopy of $source_dir to $target_dir: $!";
        
    exit 0;

Could you please help me with sme sample script to do this

Thanks a lot

---------- Post updated at 03:53 AM ---------- Previous update was at 01:19 AM ----------

Can you pls provide some sample code to copy..
# 2  
Old 03-29-2011
Sounds like you havent got NCopy installed

Example:-

http://joysofprogramming.com/install...y-perl-ubuntu/
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Not able to copy the file in perl cgi script

Hello experts, I am facing an very typical problem and hope the issue can be solved. I have a page download.cgi in /cgi-bin folder. use CGI; use CGI::Carp qw ( fatalsToBrowser ); use File::Copy copy("C:\\Program Files\\Apache Software... (8 Replies)
Discussion started by: scriptscript
8 Replies

2. Shell Programming and Scripting

Copy a file from local host to a list of remote hosts --- perl script

Hi friends, i need to prepare a script ( in perl) i have a file called "demo.exe" in my local unix host. i have a list of remote hosts in a file "hosts.txt" now i need to push "demo.exe" file to all the hosts in "hosts.txt" file. for this i need to prepare a script(in perl, but shell... (5 Replies)
Discussion started by: siva kumar
5 Replies

3. Shell Programming and Scripting

Copy Data from CSV file to Excel Sheet using Perl

Hi All, Firstly I will like to wish A Happy New Year to all. Now my issue is I have one csv file say(data.csv) and one excel file say(result.xls) The result.xls contains two sheet name Sheet1 and Sheet2, Now What I am trying to do is to First I want to delete that data of Sheet2 if present any,... (6 Replies)
Discussion started by: adisky123
6 Replies

4. Shell Programming and Scripting

Perl script to copy last directory

Hi, Plaese help me with perl script which copies the latest directory This is a double post. Continue at your original thread. Thanks. (0 Replies)
Discussion started by: shaveta
0 Replies

5. Shell Programming and Scripting

copy tail output to an external file in perl

The below code works to tail client.log file. but I want to copy the output into an external file /home/tail.txt Can anyone please help. #!/opt/bin/perl -w open my $pipe, "-|", "/usr/bin/tail", "/var/log/client.log" or die "could not start tail on /var/log/client.log : $!"; print while... (2 Replies)
Discussion started by: sureshcisco
2 Replies

6. Shell Programming and Scripting

Copy input to log file in perl

Can anyone please correct the code. I am trying to copy the user input to an output file log.txt: the script works fine but when I am trying to copy the user input error is generated. Thanks in advance. #!/usr/bin/perl $temp = "/home/log.txt"; $reply = ""; print 'Enter the code:... (1 Reply)
Discussion started by: sureshcisco
1 Replies

7. Shell Programming and Scripting

Perl copy vs system cp

What are the pros & cons, if any, between using Perl's copy module vs OS's system cp, for copying a file to another directory? Or are they exactly the same? 1) Perl's File::Copy module, as in copy ($filename, $dest_path) or die "ERROR: Cannot copy\n"; 2) if (system ("cp $filename,... (3 Replies)
Discussion started by: slchin
3 Replies

8. Shell Programming and Scripting

Perl or Awk script to copy a part of text file.

Hi Gurus, I'm a total newbie to Perl and Awk scripting. Let me explain the scenario, there is a DB2 table with 5 columns and one of the column is a CLOB datatype containing XML. We need all the 4 columns but only a portion of string from the XML column. We decided to export DB2 table to a .del... (26 Replies)
Discussion started by: asandy1234
26 Replies

9. Shell Programming and Scripting

PERL - copy fiel contents to array then compare against other file

Basically to illuminate i want to take a file with mutliple lines, C:\searching4theseletters.txt a b c Read this into an array @ARRAY and then use this to compare against another file C:\inputletters.txt b o a c n a (9 Replies)
Discussion started by: bradleykins
9 Replies

10. Shell Programming and Scripting

PERL: Read from Database and copy

I have a microsoft access database with anout 220 lines. theres a question and 4 option awnsers and only ones correct which is also listed in th database. Is there any perl script that will copy and the lines from the database and put into a .asp website ? (2 Replies)
Discussion started by: perleo
2 Replies
Login or Register to Ask a Question