in reply to Re: File name is long to copy
in thread File name is long to copy

Good advice. I'd include the paths too as the longer they are the more likely it is that one of them may have a typo.

copy( $source, $target ) or die "couldn't copy file '$source' to '$tar +get': $!";

Replies are listed 'Best First'.
Re^3: File name is long to copy
by harishnv (Sexton) on Apr 26, 2020 at 13:29 UTC

    the other files in that folder are copied but not this, if I reduce the name of the file then it works but that is not possible for me.

      SSCCE works for me.

      use strict; use warnings; use File::Copy 'copy'; use Test::More tests => 1; my $longname = 'foo_' . ('z' x 200); open my $fh, '>', $longname; print $fh "Hello!\n"; close $fh; my $toname = 'bar_' . ('z' x 200); ok copy ($longname, $toname) or diag $!;

      Maybe your O/S or your filesystem is the problem here?

        I don't think file system issue because other files in that folder are copied. I suspect only the file name issue. Can we copy the whole directory along with sub dir and files in one line of code?