in reply to copying files with system()

Might I suggest two things.

  1. File::Copy instead of system
  2. strict always helps

Replies are listed 'Best First'.
Re: Re: copying files with system()
by RayRay459 (Pilgrim) on Jul 20, 2001 at 01:33 UTC
    using this code:
    #!D:\perl\bin\perl use File::Copy; $listFile = "list.txt"; open(LIST, $listFile) || die "Cant open $listFile : $!"; while(<LIST>) { copy("\\\\$_\\c$\\testtxt.txt,C:\\resologs,"); } close(LIST);
    I get this error: Usage: copy(FROM, TO , BUFFERSIZE) at C:\scripts\perl\GetLogFiles2.pl line 9. Does anyone know what i am doing wrong?
      As ichimunki said in (ichimunki) Re: copying files with system(), you can just use regular unix type pathes such as copy("/testtxt.txt", "/resologs/");, to avoid having to escape the path for windows.

      update:
      Taken from CB: <tye> copy("file1,file2") is not the same as copy("file1","file2")