VBscript or BATscript to comapre and copy files within 2 folders .
i have 2 folders A(sourceDIR) and B(targetDIR). Folder A keepon generating .dll file , some time edit existing files also.
i want to script, when it run will copy all new as well as modified exist files from folder A to B.
any body help.
-
sometime folder A having subfolder, so compare with folder A as well as subfolder and copy as it is subfolders in folder B. - vjay 10 years ago
-
Er...heard of XCopy or RoboCopy? - anonymous_9363 10 years ago
Answers (2)
Hi,
Here is a script I created to help me do copy jobs:
set source=\\YOURSOURCELOCATION
set destination=\\YOURDESTINATIONLOCATION
robocopy %source% %destination% /MIR /E /V /R:1 /W:1 /XO /LOG+:c:\temp\%source%-CopyTo-%destination%.log.txt
All you have to do is change "\\YOURSOURCELOCATION" and "\\YOURDESTINATIONLOCATION"
I also added logging, you need the c:\temp folder or the logs wont right.
/MIR: mirrors source to destination
/E: copy empty folders
/V: verbose for tracking in logs
/R:1: number of retries
/W:1: how long to wait till it retries (1 second)
/XO: is for attributes
/Log+: so if you run the copy job again it will just append the log file.
If you are worried about losing files you can run:
set source=\\YOURSOURCELOCATION
set destination=\\YOURDESTINATIONLOCATION
robocopy %source% %destination% /COPY:DATSO /E /V /R:1 /W:1 /XO /LOG+:c:\temp\%source%-CopyTo-%destination%.log.txt
/COPY:DATSO: will only copy newer files to destination and will not delete files. Basicly just updating files to the newest version.
Below is a useful link:
http://technet.microsoft.com/en-us/library/cc733145.aspx
- See more at: http://www.itninja.com/question/move-files-from-one-volume-to-another-while-retaining-permissions#answer-87081