Brian_Blair
asked on
BATCH FILE EXPERT NEEDED!
Scenario: 2 servers- SERV1 & SERV2. SERV1 is the master or template server. The D: drive on SERV1 has 3 directories named BLUE, GREEN, & RED. Inside these 3 directories there are dozens of other files.
GOAL: To create a batch file that when run on SERV2 will create the 3 directories(BLUE, GREEN & RED) and then copy the contents of those 3 directories to the newly created BLUE, GREEN & RED on SERV2 via UNC paths, copy commands or whatever else. In the end , if the batch file works properly it will duplicate the contents of the D: drive onto SERV2. It is safe to assume the D: drive has been sized and partitioned before this batch file is run.
I need the actual commands that a pro would use line by line.
GOAL: To create a batch file that when run on SERV2 will create the 3 directories(BLUE, GREEN & RED) and then copy the contents of those 3 directories to the newly created BLUE, GREEN & RED on SERV2 via UNC paths, copy commands or whatever else. In the end , if the batch file works properly it will duplicate the contents of the D: drive onto SERV2. It is safe to assume the D: drive has been sized and partitioned before this batch file is run.
I need the actual commands that a pro would use line by line.
ASKER
YES- there are definately sub folders. Never really thought about the security but in a perfect scenario, yes the security would be copied.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
leew- Thanks for the help. At the top of the file do I need any "cls" statements or "cd" change directory statements? Also, in some of your text you have "quotation" marks. Is this the correct syntax?
Get back to me on this and the points are yours.
Get back to me on this and the points are yours.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
One more note - to create a log that records errors, I made a mistake - you should use:
COPIER > %temp%\COPIER.LOG 2>&1
Otherwise, some programs might not save the errors to the log file.
COPIER > %temp%\COPIER.LOG 2>&1
Otherwise, some programs might not save the errors to the log file.
copy "\\serv1\sharename\blue\*.
copy "\\serv1\sharename\green\*
copy "\\serv1\sharename\red\*.*
The above should do it... but there are more questions. Do these folders have sub folders? If so, you'll probably want to use XCOPY or ROBOCOPY. Do these files have security that needs to be copied?