Batch file to copy files from one server to other server

I need a batch file that can copy all the files in a folder from one server to other server
SvlssAsked:
Who is Participating?
 
Trenton KnewConnect With a Mentor Owner / Computer WhispererCommented:
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
 
Trenton KnewOwner / Computer WhispererCommented:
robocopy [SOURCE] [DEST] /E /COPY:DATSO /W:3 /R:3
0
 
SvlssAuthor Commented:
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
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

 
SvlssAuthor Commented:
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
 
Trenton KnewOwner / Computer WhispererCommented:
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
 
Trenton KnewOwner / Computer WhispererCommented:
what are you trying to log?
0
 
SvlssAuthor Commented:
I am trying to log the results if  the files uploaded successfully or if the upload failed
0
 
Trenton KnewOwner / Computer WhispererCommented:
ok, well robocopy with the /log flag will do that...

/LOG:filename for new file
/LOG+:filename to append to existing logfile
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.