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

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?

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

    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?

        Hi,

        does Win32::Backup::Robocopy do unicode filenames?

      You can look at File::Copy::Recursive or consider using your OS (Windows?) command line tools:

      my $cmd = qq{xcopy /s "$source" "$target"}; system( $cmd ) == 0 or die "Couldn't launch [$cmd]: $!/$?";