Windows – Copying a directory from one UNC share to another using ‘move’ command fails with an access denied error but works in Windows Explorer

windows

I have a box running an SFTP server to which users are uploading directories full of files. The upload directory is acecssible on the UNC share \\ServerA\Documents\Uploads.

I am trying to write a script that will move and subfolder it finds in this share over to a share on another server. We can call that share \\ServerB\Processing\.

I can use Windows Explorer to successfully move a directory from \\ServerA\Documents\Uploads to \\ServerB\Processing\ howwever, if I open a command prompt and issue the command

move \\ServerA\Documents\Uploads\targetfolder \\ServerB\Processing\targetfolder

I receive an access denied error. Why would my permissions be different between Windows Explorer and the command line? How can I trouble shoot this?

Best Answer

Interesting problem. The next step I'd do is to see if copy and xcopy of the data also returns an error. A short little move-like script could be useful here:

xcopy \\ServerA\Documents\Uploads\TargetFolder \\ServerB\Processing\DestFolder /s/e/h
rmdir \\ServerA\Documents\Uploads\TargetFolder /s /q

The results of that could be diagnostic. If this works but move doesn't, the problem may exist in how 'move' fundamentally handles the copy-delete process.