Using ROBOCOPY

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?

ben1211Asked:
Who is Participating?
 
oBdAConnect With a Mentor Commented:
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
 
ben1211Author Commented:
I can't seem to find the /REG command in the ROBOCOPY GUI tool.
0
 
oBdACommented:
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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
ben1211Author Commented:
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
 
oBdACommented:
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
 
ben1211Author Commented:
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
 
ben1211Author Commented:
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
 
oBdACommented:
Yes.
0
 
ben1211Author Commented:
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
 
ben1211Author Commented:
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
 
oBdAConnect With a Mentor Commented:
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
 
ben1211Author Commented:
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
 
oBdACommented:
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
 
ben1211Author Commented:
when do i create the shares on the target server? after running robocopy or before?
0
 
oBdAConnect With a Mentor Commented:
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
 
ben1211Author Commented:
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
 
oBdAConnect With a Mentor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.