0

I am on a corporate VPN. I have access to two remote file shares which have windows mapped paths. I can view both file shares in Windows Explorer. My goal is to copy a 1.8 gb .csv file from one share, to the other. I can copy much smaller files with no problem, simply using windows explorer. However, for files around 300mb or greater, I get an error copying the file. The file appears in the destination file share as the correct size, but reading it into python confirms that not all the csv rows are copied.

I am now attempting to copy the file using Windows 10 PowerShell, to open the door to more control over the copy operation, rather than the GUI copy command executed through the Windows 10 desktop environment. (I am replacing the true path names, with stand-ins for privacy)

When I run: Copy-Item \\sourcePath\aFile.csv \\destinationPath\aFile.csv -Verbose -Force

I get the error

Copy-Item : An unexpected network error occurred.
At line:1 char:1
+ Copy-Item '\\sourcePath\ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Copy-Item], IOException
    + FullyQualifiedErrorId : System.IO.IOException,Microsoft.PowerShell.Commands.CopyItemCommand

I am hoping that in powershell there is some way to either make the copy operation more robust to VPN bandwidth/connection stability limitations, or to cut my client computer out of the copy operation, and order the source file share to directly copy the file to the destination machine, without my machine serving as a middle man relay between the two. It is clear from my network traffic that my machine is downloading and then uploading the file while the failing copy operation runs.

2 Answers 2

0

Are you looking to replace the same item that's in the remote path?

Copy-Item -path \\sourcePath\aFile.csv -destination \\destinationPath\aFile.csv\ -Verbose -Force

It could very well be creds aren't being passed since youre on a VPN which you would have to double hop.

Sign up to request clarification or add additional context in comments.

3 Comments

I'd like to replace the file in destination yes. I've been partly copying it, so it's necessary to overwrite the previously written file. Credentials seem unlikely as that would result in a total failure, not an incomplete write, I imagine. The core of the problem here is that the file writes incompletely
So it does copy? Just not the full contents of the csv? Does robocopy make any difference?
You can also invoke the command to run the operation on the server it's copying from, to the server to copy too. That way it cuts you out from using up bandwidth
0

A solution is to use robocopy to copy the file.

robocopy “\\aSourcePath\\” “\\aDestinationPath\\” “aFileInSourcePath.something” /mt /z

runs until the file is transfered, is robust to VPN disruptions that seem to cause standard Windows Explorer copy/paste to fail.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.