#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2012
    Posts
    82
    Rep Power
    3

    FIle::Xcopy statistic output to a log file


    Gentlemen,
    Iím trying to use File::Xcopy and having a problem redirecting the statistic output to a log file.
    Here is my code.
    Code:
    #!/usr/bin/perl -w
       use strict ;
       use warnings ;
       use File::Xcopy ;
     
      my $dir1 = 'C:/FromTest';
      my $dir2 = 'C:/ToTest';
     
      my $fx = new File::Xcopy ;
    
          $fx->from_dir("$dir1") ;
          $fx->to_dir  ("$dir2") ;
      
          $fx->param('s',1);          
    
          $fx->param('verbose',1);   
    
          $fx->param('logfile.log','C:/Totest/');
      my ($sr, $rr) = $fx->get_stat;
          $fx->xcopy;
    Thanks, testerV
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Apr 2009
    Posts
    1,930
    Rep Power
    1225
    Try changing:
    Code:
    $fx->param('logfile.log','C:/Totest/');
    To:
    Code:
    $fx->param('log_file','C:/Totest/logfile.log');
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2012
    Posts
    82
    Rep Power
    3
    Now I got the log file. Thanks Fish!
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2012
    Posts
    82
    Rep Power
    3
    Hi,
    I have few more questions. I found if a folder has no files but subfolder/subfolders only then the Xcopy would not copy that folder even if subfolder/subfolders not empty.

    I also tried to add one more
    Code:
    $fx->param('e',1);
    To copy empty directory but it does not work.
    Thanks, testerV
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Apr 2009
    Posts
    1,930
    Rep Power
    1225
    According to the module's documentation it has only implemented the /S parameter and also states that all other xcopy paramaters will be implemented gradually. I have not looked over the source code, but since the last release was back in 2004, I'd say that those other parameters (e.g., /E) have not been implemented.

    You might be better off switching over to using File::Copy::Recursive.
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2012
    Posts
    82
    Rep Power
    3
    Thanks Fish!

IMN logo majestic logo threadwatch logo seochat tools logo