Solved

Using ROBOCOPY

Posted on 2011-02-24
17
1,076 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
Comment Utility
I can't seem to find the /REG command in the ROBOCOPY GUI tool.
0
 
LVL 82

Expert Comment

by:oBdA
Comment Utility
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
Comment Utility
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
 
LVL 82

Expert Comment

by:oBdA
Comment Utility
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
Comment Utility
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
Comment Utility
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 82

Expert Comment

by:oBdA
Comment Utility
Yes.
0
 

Author Comment

by:ben1211
Comment Utility
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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 82

Accepted Solution

by:
oBdA earned 500 total points
Comment Utility
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
Comment Utility
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 82

Assisted Solution

by:oBdA
oBdA earned 500 total points
Comment Utility
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
Comment Utility
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 82

Expert Comment

by:oBdA
Comment Utility
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
Comment Utility
when do i create the shares on the target server? after running robocopy or before?
0
 
LVL 82

Assisted Solution

by:oBdA
oBdA earned 500 total points
Comment Utility
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
Comment Utility
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 82

Assisted Solution

by:oBdA
oBdA earned 500 total points
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

The password reset disk is often mentioned as the best solution to deal with the lost Windows password problem. In Windows 2008, 7, Vista and XP, a password reset disk can be easily created. But besides Windows 7/Vista/XP, Windows Server 2008 and ot…
When you upgrade from Windows 8 to 8.1 or to Windows 10 or if you are like me you are on the Insider Program you may find yourself with many 450MB recovery partitions.  With a traditional disk that may not be a problem but with relatively smaller SS…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

772 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

10 Experts available now in Live!

Get 1:1 Help Now