Solved

Using ROBOCOPY

Posted on 2011-02-24
17
1,160 Views
Last Modified: 2012-05-11
I posted a question about this previously, but am confused with the command given. I want to use the ROBOCOPY GUI Tool (Download "Robocopy GUI" from this location:
http://technet.microsoft.com/en-us/magazine/2006.11.utilityspotlight.aspx)

I need to know the exactl command to copy all the files from 198.1.1.3 - P Drive to 198.1.1.5 E Drive\Com Folder.

I don't want any of the source files to be deleted so that I can compare later on.

I need help with the exact command please?

0
Comment
Question by:ben1211
  • 9
  • 8
17 Comments
 

Author Comment

by:ben1211
ID: 34968472
I can't seem to find the /REG command in the ROBOCOPY GUI tool.
0
 
LVL 83

Expert Comment

by:oBdA
ID: 34968740
The script below will mirror everything P: from the first server to E:\Com on the second server. If you start it a second time, files that were deleted in the source will be deleted in the target as well, so that the folders are identical again after the copy. A time-stamped log file will be created.
Currently, NTFS permissions aren't copied; add /copyall if you want to transfer the security settings as well.
@echo off
setlocal
for /f "tokens=1-3 delims=/" %%a in ("%Date%") do (
  set mm=%%a
  set dd=%%b
  set yy=%%c
)
set TimeStamp=%yy%-%mm%-%dd%
robocopy "\\198.1.1.3\P$" \\198.1.1.5\E$\Com *.* /mir /r:1 /w:1 /tee /np /log+:"%~dpn0-%timestamp%.log"

Open in new window

Some more hints:
- robocopy will *by* *default* only copy files that don't exist in the same version in the target yet, so you can just run it several times and it will only copy the differences after the initial run.
- /mir already includes /e or /s
- /nfl and /ndl will suppress the file and folder listing of *successfully* copied files/folders; errors will still be logged. Having log entries for files that were successfully copied usually are of no interest and only clutter up the log
- /r and /w in a LAN are usually unnecessary; if a copy doesn't work, it's mostly "access denied", either because the file is in use or because someone thought he's so very smart that he doesn't need his files backed up, denying admin access. Retries won't change that and will only slow down the copy.
- /np disables the progress indicator. Very nice thing if you have the time to stare at the screen, willing the percentage to move, and if you copy files that are so large that a progress indicator actually makes sense. If writing to a log, it's totally counterproductive, because it fills the log with control characters.
- /z, /b, or /zb will slow down the copy because of the additional overhead, with not much benefit in a LAN. /z is useful if copying over WAN connections, and /b only if the account you're using doesn't have full control over the folder tree.
- You might want to pre-create the target "Main" folder and set the same permissions as the source folder; in my experience, robocopy sometimes fails to set the permissions correctly when it has to create the target folder. Everything below should be processed correctly.

0
 

Author Comment

by:ben1211
ID: 34969116
OBDA....where do i add the copy all please?

I'm a rookie in this and really need help. Could you give me the full command that would copy all NTFS permissions as well as shares please?

Secondly, i noticed that there are some files in the source directory with long files names. will this be a problem? and if there are any directories that are corrupted, will this also be a problem?

0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 83

Expert Comment

by:oBdA
ID: 34969156
Long file names won't be a problem.
The /copyall can be added basically anywhere after the file mask:
robocopy "\\198.1.1.3\P$" \\198.1.1.5\E$\Com *.* /copyall /mir /r:1 /w:1 /tee /np /log+:"%~dpn0-%timestamp%.log"
Corrupted folders will (probably) result in errors.
Shares can't be copied, they are not related to the file system, they're part of the Lanmanserver configuration. Since the path on the old server differs from the path on the new server anyway, it's probably best to create the shares manually (and keep in mind that since W2k, you can directly map into a subfolder of a share).
0
 

Author Comment

by:ben1211
ID: 34975873
OBDA....i basically run this command from the server 198.1.1.3, am i correct?

robocopy "\\198.1.1.3\P$" \\198.1.1.5\E$\Com *.* /copyall /mir /r:1 /w:1 /tee /np /log+:"%~dpn0-%timestamp%.log"

On server 198.1.1.3, the P Drive is shared. On server 198.1.1.5 I need to create a folder on the E Drive and then move all the folders from P Drive on 198.1.1.3 to the E Drive \ Com folder on 198.1.1.5.

So when do I share the Com folder on 198.1.1.5?
0
 

Author Comment

by:ben1211
ID: 34975966
OBDA...the disk on 198.1.1.3 - P Drive has this problem : The device, \Device\Harddisk1, has a bad block.

Will I still be able to run robocopy?
0
 
LVL 83

Expert Comment

by:oBdA
ID: 34977451
Yes.
0
 

Author Comment

by:ben1211
ID: 34977470
OBDA....

I run this exact command from 198.1.1.3. Can I remove the %timestamp%.

Meaning i don't use the script, but from the command prompt window on 198.1.1.3, i can run this command? Where exactly do i run it from?

robocopy "\\198.1.1.3\P$" \\198.1.1.5\E$\Com *.* /copyall /mir /r:1 /w:1 /tee /np /log+:"%~dpn0-%timestamp%.log"

On server 198.1.1.3, the P Drive is shared. On server 198.1.1.5 I need to create a folder on the E Drive and then move all the folders from P Drive on 198.1.1.3 to the E Drive \ Com folder on 198.1.1.5.

So when do I share the Com folder on 198.1.1.5?
0
 
LVL 83

Accepted Solution

by:
oBdA earned 500 total points
ID: 34977507
In a command prompt, you can just enter something like
robocopy "\\198.1.1.3\P$" \\198.1.1.5\E$\Com *.* /copyall /mir /r:1 /w:1 /tee /np /log:"robocopy-20110225.log"

If the E: drive is a normal hard drive in the machine (not a USB plugin or some such, it should be administratively shared and be accessible through \\198.1.1.5\E$

Note that you can add the /L switch to robocopy, which means robocopy will only pretend to copy, but not actually copy anything; this is convenient for testing. A robocopy job can be canceled by hitting Ctrl-C in the command prompt from where it was started.
0
 

Author Comment

by:ben1211
ID: 34978831
OBDA....E Drive is not shared on 198.1.1.5.

There are other directories in the E Drive of 198.1.1.5

I am creating a directory called COM on 198.1.1.5 and want to move all the files from 198.1.1.3\P$ to 198.1.1.5 E DRIVE Com folder.

Will the Com folder automatically be shared after Robocopy has run?

P Drive on 198.1.1.3 is a shared drive.

0
 
LVL 83

Assisted Solution

by:oBdA
oBdA earned 500 total points
ID: 34978945
Then create the Com folder, configure it with the same NTFS permissions you have on the root of the P: drive (the source folder) and share the folder as "Com" (don't forget to give Everyone Full access in the Share permissions.
Then use "\\198.1.1.5\Com" as target folder:
robocopy "\\198.1.1.3\P$" "\\198.1.1.5\Com" *.* /copyall /mir /r:1 /w:1 /tee /np /log:"robocopy-20110225.log"
0
 

Author Comment

by:ben1211
ID: 34995226
OBDA.....

Assuming there are many shared folders on 198.1.1.3, when ROBOCOPY is run, will the same shared folders from 198.1.1.3 be created on 198.1.1.5 and shared out?
0
 
LVL 83

Expert Comment

by:oBdA
ID: 34995247
As I said in http:#a34969156: Shares can't be copied, they are not related to the file system, they're part of the Lanmanserver configuration. Since the path on the old server differs from the path on the new server anyway, it's probably best to create the shares manually (and keep in mind that since W2k, you can directly map into a subfolder of a share).
0
 

Author Comment

by:ben1211
ID: 35015074
when do i create the shares on the target server? after running robocopy or before?
0
 
LVL 83

Assisted Solution

by:oBdA
oBdA earned 500 total points
ID: 35015119
Well, the folders have to be there in the first place, so you have to create the shares after an initial run of robocopy.
0
 

Author Comment

by:ben1211
ID: 35023571
OBDA, i'm confused. Ok...on the source server 198.1.1.3, i have shared folders here. I want the entire P drive to be migrated to 198.1.1.5\ E Drive \ Com Folder.

1. On the Target Server 198.1.1.5, do I first need to create the entire folder stucture that's existing on the source server 198.1.1.3, first?

2. When I run the command you have given to me robocopy "\\198.1.1.3\P$" "\\198.1.1.5\Com" *.* /copyall /mir /r:1 /w:1 /tee /np /log:"robocopy-20110225.log"  - will all the files be migrated to the E:\Com folder? Please note, I have only created the Com folder on E Drive, but not shared it out yet. Should it be shared before the above command is issued?

3. Once I have run robocopy, the command provided above, will the shares on the source server (198.1.1.3) be unshared after robocopy has completed? If this happens, then I won't know which folders to share in on the target server.
0
 
LVL 83

Assisted Solution

by:oBdA
oBdA earned 500 total points
ID: 35024761
1. The folder structure will be created by the robocopy job.
2. The "com" folder will obviously have to be shared in order to be used as copy target, unless you run the copy on the 198.1.1.5 machine and use the local path as target.
3. Again: robocopy will do nothing related to shares. It will not create any shares, it will not delete any shares.

I'd suggest you simply try this with a small test folder as source.
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VMWare Template 9 28
moving second domain to new remote site 2 19
Office 2016 Error 4 63
No More local names in the certificate starting November 2015 4 125
Preface Having the need * to contact many different companies with different infrastructures * do remote maintenance in their network required us to implement a more flexible routing solution. As RAS, PPTP, L2TP and VPN Client connections are no…
INTRODUCTION The purpose of this document is to demonstrate the Installation and configuration of the Data Protection Manager product. Note that this demonstration was prepared on the basis of Windows OS is 2008 R2 and DPM 2010. DATA PROTECTI…
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…
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…

803 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