Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invalid drive specification using XCOPY

Tags:

batch-file

I want to run batch file which copy all relevant folders and sub-folders from a remote computer to my client computer. I am using the following XCOPY command:

xcopy "\\Server_Name\C$\folder_X\folder_Y" "C:\Users\\folder_Z" /I /S /Y /D:%mydate%  

and got "invalid drive specification" upon running the batch file.

(maybe it related: when trying connect manually via windows "run", typing \\Server_Name\C$\
,I got prompt to enter user and password and after that I can enter the relevant folders).

Thanks

like image 751
Popa Avatar asked Jul 23 '14 09:07

Popa


People also ask

Does xcopy use SMB?

Since Windows Server 2019 and Windows 10, a compression option is available in xcopy when copying across a network. With this switch, if the destination computer supports SMB compression and the files being copied are very compressible, there may be significant improvements to performance.

How do I copy files using xcopy?

Press F if you want the file or files to be copied to a file. Press D if you want the file or files to be copied to a directory. You can suppress this message by using the /i command-line option, which causes xcopy to assume that the destination is a directory if the source is more than one file or a directory.

What is the difference between copy and xcopy?

XCOPY is similar to the COPY command except that it has additional switches to specify both the source and destination in detail. /D:mm-dd-yyyy Copy files changed on or after the specified date. If no date is given, copy only files whose source date/time is newer than the destination time.


1 Answers

Try mounting your remote drive locally first:

net use x: \\Server_Name\C$

Then try copying the files from X: instead:

xcopy x:\folder_X\folder_Y c:\Users\folder_Z ... 

To unmount:

net use x: /delete
like image 190
konsolebox Avatar answered Sep 29 '22 11:09

konsolebox