Solved

The Robocopy command and operation

Posted on 2012-03-14
26
834 Views
Last Modified: 2012-04-23
dear all,

We run the follow command to copy everything in a Windows 2008 R2 volume to a folder and try to restore it later on from that folder, we do this:

C:\>robocopy J:\  x:\J_drive /FP /E  /COPYALL  /R:5 /W:1 /ETA /Log:c:\robocopy\robolog_J_backup.txt /TEE /V /Save:c:\robocopy\Job_J_backup
C:\>robocopy L:\  x:\L_drive /FP /E  /COPYALL  /R:5 /W:1 /ETA /Log:c:\robocopy\robolog_L_backup.txt /TEE /V /Save:c:\robocopy\Job1_L_backup

But when we do this, we found that:
1) we have to create the x:\J_drive in advance before this command works.
2) when the copy start, the folder J_drive will be hiden and it is not unhide anymore.

Any way to make the fold unhide again ? once the robocopy was start, it seems the owner is administrator, not the account I run this command.

DBA100.
0
Comment
Question by:marrowyung
  • 16
  • 9
26 Comments
 
LVL 4

Assisted Solution

by:Paul-B
Paul-B earned 50 total points
ID: 37723424
I'm not sure I fully understand you, but can't you just add commands to a batch file like

attrib -h X:\J_drive 
attrib +h X:\J_drive 

Open in new window


to hide or unhide it? -h to unhide and + to hide.
0
 
LVL 38

Expert Comment

by:Aaron Tomosky
ID: 37723508
It's a problem with copying the root of a drive. Robocopy tries to inherit permissions and there aren't any. I never found a good solution.
0
 
LVL 1

Author Comment

by:marrowyung
ID: 37723549
aarontomosky,

So what can I do ?

run this :
attrib -h X:\J_drive
attrib +h X:\J_drive
?

Paul-B:

I only run this one after the copy done, right?

DBA100.
0
 
LVL 1

Author Comment

by:marrowyung
ID: 37723607
When I run attrib -h X:\Backup\Z_drive , I get:

"Not resetting system file - X:\Backup\Z_drive" error.

Any other method?

DBA100.
0
 
LVL 1

Author Comment

by:marrowyung
ID: 37723631
Dear all,

Based on the command from my question:"

C:\>robocopy J:\  x:\J_drive /FP /E  /COPYALL  /R:5 /W:1 /ETA /Log:c:\robocopy\robolog_J_backup.txt /TEE /V /Save:c:\robocopy\Job_J_backup
C:\>robocopy L:\  x:\L_drive /FP /E  /COPYALL  /R:5 /W:1 /ETA /Log:c:\robocopy\robolog_L_backup.txt /TEE /V /Save:c:\robocopy\Job1_L_backup


How can I make use of the Windows VSS to make the whole copy process faster ?

DBA100.
0
 
LVL 38

Expert Comment

by:Aaron Tomosky
ID: 37724963
What I did was robocopy each of the folders in the root of the drive instead of the actual root. If you have a bunch of stuff in there you can do a for to loop instead of typing them all in. I have one written I'll post when I get to the office.
0
 
LVL 1

Author Comment

by:marrowyung
ID: 37728330
aarontomosky,

Yes, please post here.

Or what I found out how to fix it is a bit troublesome.

I need to do is to change the ownership of the target folder to the account I use to login and start the copy process.

Then I have to open the property page of that target folder and run the unhide command.

but if you were me, how can I make use of the Windows VSS to make the whole copy process faster ?

I can take a snapshot of the whole volume and just restore that volume, right?

DBA100.
0
 
LVL 38

Expert Comment

by:Aaron Tomosky
ID: 37730302
my robocopy looks like this:
FOR %%F in (dir /b .*) DO robocopy J:\%%F Z:\Jbackups\%%F\ /S /NJH /NJS

that will grab a list of all the folders in j, and copy them to z:\jbackups. Since it's not actually coping the root of the drive, it works for me.
0
 
LVL 1

Author Comment

by:marrowyung
ID: 37740695
aarontomosky,

the command "FOR %%F in (dir /b .*) DO" is not dos command, what it is ?

DBA100.
0
 
LVL 38

Expert Comment

by:Aaron Tomosky
ID: 37740809
It runs in a batch file (.bat). Make a txt file called dobackups.txt
Rename it dobackups.bat
Paste that text inside.
0
 
LVL 1

Author Comment

by:marrowyung
ID: 37740874
aarontomosky,

IF I do it in command line and it doesn't work, how can the batch file works?

Also it seems keep running but never copy sth. the command prompt just hang when it run for a while.

DBA100.
0
 
LVL 38

Expert Comment

by:Aaron Tomosky
ID: 37742637
Please paste the contents of your bat file here
0
 
LVL 1

Author Comment

by:marrowyung
ID: 37810297
FOR %%F in (dir /b .*) DO robocopy J:\%%F  X:\Y_drive\%%F\ /FP /E  /COPYALL  /R:5 /W:1 /ETA  /TEE /V

It is all inside my robocopy.bat file, please suggest what happen.
0
The problems with reply email signatures

Do you wish that you could place an email signature under a reply? Well, unfortunately, you can't. That great Exchange/Office 365 signature you've created will just appear at the bottom of an email chain. What a pain! Is there really no way to solve this? Well, there might be...

 
LVL 38

Expert Comment

by:Aaron Tomosky
ID: 37811854
For this to work the bat has to be in the root of j. Is that where it is?
0
 
LVL 1

Author Comment

by:marrowyung
ID: 37812293
no. in c:\. As I want to Robocopy J:\ to a folder called Y_drive in X:\
0
 
LVL 38

Expert Comment

by:Aaron Tomosky
ID: 37812350
FOR %%F in (dir j:\ /b .*) DO robocopy J:\%%F  X:\Y_drive\%%F\ /FP /E  /COPYALL  /R:5 /W:1 /ETA  /TEE /V

Adding the j reference to the dir command should let you put the bat file anywhere
0
 
LVL 1

Author Comment

by:marrowyung
ID: 37831437
it still hangs.
0
 
LVL 1

Author Comment

by:marrowyung
ID: 37831448
it seems keep repeating "Robocopy j:\dir x:\y_drive\dir\ /FP /E /COPYALL /R:5 /W:1 /ETA /TEE/ V
0
 
LVL 38

Expert Comment

by:Aaron Tomosky
ID: 37832416
Take the
dir j:\ /b
Or your version from the batch file and paste it into a cmd prompt. It should give you a directory list of not, make sure there is a space between the slashes \ /
0
 
LVL 1

Author Comment

by:marrowyung
ID: 37835673
aarontomosky,

I did ! it is the same result as I do "dir j:\ /b .*", just don't know why it hangs, I execute the whole thing as administrator.

DBA100.
0
 
LVL 1

Author Comment

by:marrowyung
ID: 37835683
it seems keep copying the same folder again and again.
0
 
LVL 38

Accepted Solution

by:
Aaron Tomosky earned 450 total points
ID: 37835970
I don't know what all the extra / stuff you have on there is doing offhand, I'd suggest using just /s to get started. Something in there could be messing it all up. I usually do /s (sub folders) /fft (adds a 2 second window for file time changes)

It also looks like there is a space between the last / v
0
 
LVL 1

Author Comment

by:marrowyung
ID: 37836435
Can you create that .bat and attach here? I will just try it using yours and see what is missing.

you mean there space between "/TEE" and "/v", your example has this.
0
 
LVL 1

Author Comment

by:marrowyung
ID: 37836450
But what I want to say is , dir y:\ /b .* does works. but not after adding FOR %%F
0
 
LVL 1

Author Comment

by:marrowyung
ID: 37836453
if I do "FOR %%F in (dir y:\ /b .*) DO", it will say %%F was unexpected at this time, is it a hints to you ?
0
 
LVL 1

Author Closing Comment

by:marrowyung
ID: 37879837
Even the answer can't slove my problem, I give mark for anyone who helped me.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

914 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now