in reply to Re^5: file is not getting copied
in thread file is not getting copied

So my confusion is how to resolve this problem ? I am giving source and destination properly and files do exist in specified location. I am using copy function properly. SO why is it not working ?

Thanks

Replies are listed 'Best First'.
Re^7: file is not getting copied
by Corion (Patriarch) on Jul 17, 2011 at 19:02 UTC

    If it is not working, at least one of your assumptions is wrong. Test them one by one:

    # Test if $copy_from exists: -f $copy_from or die "File '$copy_from' does not exist"; # Test if the directory for $copy_to exists: use File::Basename; my $target_dir = dirname($copy_to); -d $target_dir or die "Target directory '$target_dir' does not exist";
Re^7: file is not getting copied
by Anonymous Monk on Jul 18, 2011 at 03:06 UTC
    #!/usr/bin/perl -- use strict; use warnings; use Path::Class; ## exists #~ my $file = q[C:\Program Files\Mozilla Firefox\chrome\icons\default\ +chatzilla-window.ico]; my $file = q[C:\Program Files\Mozilla Firefox\chrome2\icons2\default2\ +chatzilla-window2.ico]; $file = file($file); while( not -r $file ){ printf "($file):\n(%d)(%s)\n(%d)(%s)\n\n", $!,$!,$^E,$^E; $file = $file->parent; } print "$file\n\n"; __END__ (C:\Program Files\Mozilla Firefox\chrome2\icons2\default2\chatzilla-wi +ndow2.ico): (2)(No such file or directory) (3)(The system cannot find the path specified) (C:\Program Files\Mozilla Firefox\chrome2\icons2\default2): (2)(No such file or directory) (3)(The system cannot find the path specified) (C:\Program Files\Mozilla Firefox\chrome2\icons2): (2)(No such file or directory) (3)(The system cannot find the path specified) (C:\Program Files\Mozilla Firefox\chrome2): (2)(No such file or directory) (2)(The system cannot find the file specified) C:\Program Files\Mozilla Firefox