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

"could not do at C:\sandboxes\Scripts\dummy.pl line 9" the error I got. any other solution? or can I copy the folders, sub folders and files in line of code? I'm using Windows

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

    Which version of Windows? It doesn't look like you tried what I suggested, note the $!

    copy( $source, $target ) or die "couldn't copy file $!"; #---------------------------------------------------^

      The error is "couldn't copy file No such file or directory at C:\sandboxes\Scripts\dummy.pl line 9."

        I suggest changing the error message like hippo advised here
        "couldn't copy file '$source' to '$target': $!";
        and perhaps count the backslashes.

        If you are convinced the path/filename is correct, can you replace the copy with syscopy to make use of Win32::CopyFile via Win32API? Which version of Perl are you running?

      Windows 10 and the file is present because there are other files which I copy in that directory