tags:

views:

348

answers:

4

I am trying to run a batch file to copy a backup file from one location to other.

I keep on getting the error:

Invalid drive specification

My path is as follows:

\\server\drive:\folder\folder\folder\*.bak  drive:\folder\.bak
+2  A: 

That typically doesn't work out too well. You'll want this:

cp \\server\C$\folder\folder\folder\copy.bak C:\folder\copied.bak

This presupposes that you actually have access to the folder \\server\C$\folder\folder\folder from your box. If you do not, then you need to configure permissions correctly on the server to give you access.

Eric
A: 

I tried

cp \\server\C$\folder\folder\folder\copy.bak C:\folder\copied.bak

Did not work

Thanks

1. Add a comment to my post, don't just add an answer when you're giving more info. 2. Do you have access to the remote drive? Can you navigate Windows Explorer to `\\server\C$\`? If you can't, then that's your answer.
Eric
+2  A: 

You only have access to administrative shares (\\server\C$ <- the $ denotes an admin share) if you have administrative rights on the server. If you don't you need to actively share the folder in question, i.e. on the server, navigate to drive:\folder\folder\folder and share it (context menu of the folder, menu item Sharing and Security). Note that you need at least temporary admin rights on the server in order to create a share.

Do not forget to configure the permissions for the share you create, so that the limited account you are using for the copy process has read rights.

Once this is et up, you should be able to copy the files using

Copy \\Server\NewShareName\*.bak  c:\folder\.bak

If you have problems with the files being in use by another process, have a look at robocopy instead of the copy command.

Treb
A: 

Eric, Thanks for your help. I posted the answer with a sigle slash by mistake but I did try with a double slash and stil did not work.No... your comment is not dumb at all.