Solved

Batch file to copy files from one server to other server

Posted on 2015-01-14
8
129 Views
Last Modified: 2015-01-14
I need a batch file that can copy all the files in a folder from one server to other server
0
Comment
Question by:Svlss
  • 5
  • 3
8 Comments
 
LVL 9

Expert Comment

by:Trenton Knew
ID: 40549067
robocopy [SOURCE] [DEST] /E /COPY:DATSO /W:3 /R:3
0
 

Author Comment

by:Svlss
ID: 40549077
Trenton I tried your suggestion but it dint work how can we edit to write results to a file

robocopy D:\Test \\server\sharedfolder /E /COPY:DATSO /W:3 /R:3
0
 

Author Comment

by:Svlss
ID: 40549087
I tried this and it worked but I want the batch file to write logs. how can I do that ?

copy D:\Test\*.*  \\server\sharedfolder
0
 
LVL 9

Expert Comment

by:Trenton Knew
ID: 40549093
you want to write the robocopy command output to a file? Two ways to do this.  You can direct ALL output to the file (no screen output), or output to both the file and the screen.

robocopy D:\test \\server\sharedfolder /E /Copy:DATSO /W:3 /R:3 /V /LOG:logfilename /TEE

/E copies all directories, even empty ones
/W:3 waits 3 seconds between failures
/R:3 limits retries to 3 times (default is a million)
/V verbose output
/TEE spits output to the  filename under /LOG and to the screen
/COPY: tells robocopy what to copy.  the important parts here are (D)ata (A)ttributes (T)imestamps.  (O)wner and (S)ecurity are important, but can sometimes trip you up.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 9

Expert Comment

by:Trenton Knew
ID: 40549094
what are you trying to log?
0
 

Author Comment

by:Svlss
ID: 40549096
I am trying to log the results if  the files uploaded successfully or if the upload failed
0
 
LVL 9

Expert Comment

by:Trenton Knew
ID: 40549115
ok, well robocopy with the /log flag will do that...

/LOG:filename for new file
/LOG+:filename to append to existing logfile
0
 
LVL 9

Accepted Solution

by:
Trenton Knew earned 500 total points
ID: 40549121
try

robocopy D:\test \\server\share /E  /LOG+:robocopy.log /TEE /V

Open in new window


Also, add /XO if you do not need to recopy files that have not been modified
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Here we come across an interesting topic of coding guidelines while designing automation test scripts. The scope of this article will not be limited to QTP but to an overall extent of using VB Scripting for automation projects. Introduction Now…
This is about my first experience with programming Arduino.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

757 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

23 Experts available now in Live!

Get 1:1 Help Now