Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Help Making Robocopy Work

Posted on 2006-05-19
15
Medium Priority
?
9,032 Views
Last Modified: 2012-08-13
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.
0
Comment
Question by:jimmysupport
  • 5
  • 3
  • 3
  • +2
15 Comments
 
LVL 10

Expert Comment

by:victornegri
ID: 16722858
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.
0
 
LVL 44

Expert Comment

by:scrathcyboy
ID: 16723065
ROBOCOPY  Z:\*.bck  F:\alpha\  /mov
0
 
LVL 44

Expert Comment

by:scrathcyboy
ID: 16723077
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.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:jimmysupport
ID: 16723095
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.
0
 
LVL 88

Expert Comment

by:rindi
ID: 16724230
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
0
 

Author Comment

by:jimmysupport
ID: 16724587
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?
0
 
LVL 88

Expert Comment

by:rindi
ID: 16724662
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.
0
 

Author Comment

by:jimmysupport
ID: 16724716
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?
0
 
LVL 88

Expert Comment

by:rindi
ID: 16724914
Is robocopy inside your path? If not you will have to tell the file where it is...
0
 
LVL 10

Expert Comment

by:victornegri
ID: 16724928
If you run the batch file manually, does the file move? Post what the output of the file is.
0
 
LVL 44

Expert Comment

by:scrathcyboy
ID: 16725940
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.
0
 
LVL 10

Expert Comment

by:victornegri
ID: 16726007
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)
0
 
LVL 44

Accepted Solution

by:
scrathcyboy earned 2000 total points
ID: 16726041
OK simple -- revised commands, two of them -

ROBOCOPY  Z:\*.bck  F:\alpha
del Z:\*.bck /Y

and if that still doesnt work then try this --

ROBOCOPY  Z:\*.bck  F:\alpha
attrib -r -s -h Z:\*.bck
del Z:\*.bck /Y

And if that does not work, you or the task manager does not have adequate permissions to remove files from the directory.

Besides, since it is only one file, then replace "ROBOCOPY" above with "copy" or "Xcopy" and eliminate the /mov switch entirely, as it is apparently trying to delete the shared directory, which it  will NOT do.
0
 
LVL 1

Expert Comment

by:toynz
ID: 16730595
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.
0
 
LVL 44

Expert Comment

by:scrathcyboy
ID: 16757141
Thank you, glad this solved it.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
Tech spooks aren't just for those who are tech savvy, it also happens to those of us running a business. Check out the top tech spooks for business owners.
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…

572 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question