Link to home
Start Free TrialLog in
Avatar of jimmysupport
jimmysupportFlag for United States of America

asked on

Help Making Robocopy Work

I have a backup file whgich is deposited on an NT machine each night. I need to MOVE the file to a Server 2003 unit.
I have been trying to use Robocopy

Here is my syntax for robo:
ROBOCOPY z:\ f:\alpha *.bck /mov

z:\where the file is ( a mapped drive on the 2003 Server).
f:\alpha is a folder on the internal hard drive named f: on the 2003 server.

So, I want to MOve the only file named .bck to f:

That's what I thought anyhow. It isn't doing it.
Thanks folks for your assistance.
Avatar of victornegri
victornegri

What error message are you getting? how about if you use the /move switch? Your syntax looks correct.

do a dir *.bak to make sure you have the correct filter.
ROBOCOPY  Z:\*.bck  F:\alpha\  /mov
Also, to help you understand the right uses of all the switches in robocopy in a backup environment, here is a complete syntax for backing up a server with 4 drives to a network backup computer --

robocopy C:\ \\backup2\d\ /s  /XF C:\pagefile.sys /R:0 /W:0 /REG
robocopy D:\ \\backup2\e\ /s
robocopy E:\ \\backup2\f\ /s
robocopy F:\ \\backup2\g\ /s  /XD F:\dir1\
robocopy G:\ \\backup2\h\ /s  /XD G:\dir2\ G:\dir3\

the /R:0 and /W:0 are important on the system drive because there are open files which cannot be read, and robocopy will choke if it cannot read or write these files, so this tells RC to just move past files it cannot read/write.  Robocopy is xcopy redone, and it is a great tool, better than most backup utilities.
Avatar of jimmysupport

ASKER

I get no error message. I am not after any .bak files, it is .bck. Thanks though.
scrathcyboy, you may have it..I changed my syntax and set it to run at 6:55 tomorrow am.
I name the file backup.vbs and add it to Scheduled Tasks.
Hope it works....talk tomorrow!
Thanks folks. This is the best $50 I ever spent...I get lots of good help here.
Avatar of rindi
I don't know if using a vbs extension for the file will work. Vbs would be for a visual basic file, and it would therefore also expect Visual Basic code, but the coomands you are using for robocopy have nothing to do with visual basic. Try running it as a normal batch file with a .bat extension:

backup.bat
That might be the issue. Under scheduled tasks it says it is running...but the file hasn't been moved.
Another issue is - when we get it to work..then the next day I need it to over write the existing file, with no intervention required, is there another switch I need to add to do that?
Try /IS and if that doesn't work, yo could just add a del command to the beginning of the batch file, so the file gets deleted before it is copied by robocopy.
Well the file is still sitting there.
It said it was running...but nothing. I changed the name to .bat and told it to run..nothing.
The results show 0x10

What the heck is happening here?
Is robocopy inside your path? If not you will have to tell the file where it is...
If you run the batch file manually, does the file move? Post what the output of the file is.
The commands I gave you work.  There is probably something wrong with the task scheduler.  Also rename the extension .CMD for any server OS rather than BAT.  Check your scheduling, and make sure that the scheduler has the correct ADMIN rights to do this task -- it is in the scheduler interface, and you have to be loggin in as ADMIN or Backup operator for this to work.  The robocopy command you had was not correct. The one I gave you is correct.
Actually, the syntax he had would work also. According to the robocopy help file:
ROBOCOPY source_folder destination_folder [file(s)_to_copy] [options]

Now the question is why it's not working with either the original command or scrathcyboy's suggestion (which is also valid ... and the way I would do it if I wrote it from scratch). A successful Scheduled task gives the exit code 0x0. He's getting 0x10 which is a "The directory cannot be removed" error. Does that shed any light on the situation?

Take a look at the error codes listed here:
http://www.hiteksoftware.com/mize/Knowledge/articles/049.htm
(0x10 translates to a decimal number of 16)
ASKER CERTIFIED SOLUTION
Avatar of scrathcyboy
scrathcyboy
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If your running it as a scheduled task as a different user to who is logged on locally on the machine then it won't be able to access the mapped network drive.
I would add the following into your bat file.
net use Z: \\servername\sharename
ROBOCOPY  Z:\*.bck  F:\alpha\  /mov
net use Z: /delete

That way it will map the drive.  Do the Robocopy and then delete the mapped drive.
Thank you, glad this solved it.