in reply to Re: file copy from windows system
in thread file copy from windows system

Thanks to everyone who has replied to this thread. Hi BrowserUK, I have used the method what you have suggested.It worked for smaller f +iles. But when the file size started increasing, the perl script star +ted hanging. In the below code snippet the shyam.txt and shyam1.txt files are of sm +aller size and it gets copied.But when the zip file is being copied, +the script hangs. The zip file is of size around 40-60MB.In the below example out of 4 f +iles only first 3 files are copied that is shyam.txt,shyam1.txt,Logs2 +011-09-19_2321.zip and the 4th zip file is not copied but script got +completed. Can you suggest if something needs to be corrected? If this works then + I need to try copying large log files of size in GBs. Also I would like to know if any perl packages are required to be inst +alled in order to achieve this. thanks in advance
my $remote_system_ip = "10.10.2.2"; my $user_name = "Administrator"; my $password = "d*diablo123"; my $source_dir = "C:\\shyam\\dir1"; my $target_file1 = "\\\\$remote_system_ip\\c\$\\shyam_IC\\shyam.txt"; my $target_file2 = "\\\\$remote_system_ip\\c\$\\shyam_IC\\shyam1.txt"; my $target_file3 = "\\\\$remote_system_ip\\c\$\\shyam_IC\\Logs2011-09- +19_2321.zip"; my $target_file4 = "\\\\$remote_system_ip\\c\$\\shyam_IC\\Logs2011-09- +19_215.zip"; `net use \\\\$remote_system_ip\\c\$ $password \/user:$user_name`; `copy \/Y $target_file1 $source_dir`; print("1"); `copy \/Y $target_file2 $source_dir`; print("2"); `copy \/Y $target_file3 $source_dir`; print("3"); `copy \/Y $target_file4 $source_dir`; print("4"); `net use \\\\$remote_system_ip\\c\$ \/delete`;

Replies are listed 'Best First'.
Re^3: file copy from windows system
by BrowserUk (Patriarch) on Jul 23, 2012 at 11:56 UTC
    Can you suggest if something needs to be corrected?

    Yes. When you are copying binary files, (like .zip files), you should be using the /b option. See copy /? for more information.

    If this works then I need to try copying large log files of size in GBs.

    Replace the copy command with the robocopy command. (Rob[ust]copy) and use the /Z option.

    Type robocopy /? for more information.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

    The start of some sanity?

      hi browserUK, robocopy worked.thanks for the information. Have not tried for larger files, will try.