I am using Copy-Item of powershell to copy files from source to destination. Below is the command which I am using.
Copy-Item -Path $fpath -Destination D:\abc\copy_location
$fpath being $fpath = $Event.SourceEventArgs.FullPath
While testing I found that it was able to copy small files but it wasn't able to copy large files (~300 - 400 MB). I have files max of around 400 MB which I have to copy from source to destination. I saw a post in stackoverflow - "Copy-Item fails on large file" where it said to use doubt quotes in the path ... i tried that as well but no success.
Please kindly advise what to do? The other option which I understand is to use robocopy command. The command being:
robocopy source destination file_to_copy
Here I am facing one issue my source is $fpath, but it gives me the full path upto the file. I only want the path upto the folder.
Still hit the same problem a few years later, when copying large files from Linux to Windows using PowerShell. Smaller filers from the same folder were copied successfully, but failed on larger files. Found a solution at the end of this https://github.com/powershell/powershell/issues/4952
Basically, you need to set MaxEnvelopeSizekb to a bigger value, 1000 worked for me for files over 6MB.