![]() IF EXIST "%%b" XCOPY "%%b" "C:\DESTINATION\?Y%" /C /Y REM Read successive lines from the log file and copy the new files into specific DAY folderįor /f "delims=] tokens=1*" %%a in ('find /v /n "" ^ logme.txt REM Compare the two destination dirctory and folder (this command will ONLY output changed/new files to a log file) **this line is giving me an error.So I removed it and put the batch file in the folder Now I run the script but modified it a bit Now in the folder I Created the following subfolders Mon, Tue, Wed etc.) for /F %%A in ('date /t') do set DAY=%%A REM Compare the two destination dirctory and folder (this command will ONLY output changed/new files to a log file) XCOPY "C:\DestinationFolder" "C:\backup\" /D /E /L /Y /C > logme.txt REM Copy new files ROBOCOPY "C:\DestinationFolder" "C:\backup\" *.* /TEE /E /R:5 /W:15 /FFT /NP REM Read successive lines from the log file and copy the new files into specific DAY folder for /f "delims=] tokens=1*" %%a in ('find /v /n "" ^ ![]() This method is not bullet proof, try to test it and let me know your concerns. I have tested it and it worked perfectly. XCOPY will step again into the log file and individually copy the new changed files to MON folder or SUN folder (which ever the day falls into) Once ROBOCOPY finish updating the destination and source folder. I used your own ROBOCOPY command to take care of updating the destination as it is more robust and effective. XCOPY will not do any copy but to report new changes. So I have used XCOPY which output for me only the new and changed files between the source and destination in to a LOG file. as its LOG file or screen output is filled with so many unwanted spaces and characters. However, I was not able to achieve this with ROBOCOPY. The trick is, to log all new/changed files in to a log file then step into the log file and individually copy each new file to the DAY folder. I think we can easily do it in a batch file this is my humble opinion.Īs for "solution 1". and perhaps you will need a much more advanced scripting. However "Solution 2" does not seem achievable with a simple batch file. and perhaps maintain a full copy only on Mondays if you prefer. and those changes will be copied to the 7 folders representing days of week. you can compare the destination folder with a database file that gets updated daily with all the folder structure, file sizes, modified date etc. Instead of comparing the destination folder with folder. If you dont wish to maintain folder daily. the batch file will always sync the destination folder with folder and maintain the file changes over 7 folders representing days of week. move those same specific files to a folder. the batch file will move the new files from the source to the folder to keep it updated and on the same time. coz this is the only way to compare and find new changed/updated/added files from two directories. an folder that will maintain a clone/sync copy of the destination. In order to achieve your request, you will need 8 folders/locations for backup. let me know which one is more close to your request. However, it seems your request is kind of complicated.īut, I have two solutions. and how I had the big picture of what you facing. In that case I would have the full backup in the ALL folder.and any changes in the Mon/Tue/Wed.folder. folder AND the to be copied to the Folder Mon/Tue/. ![]() ROBOCOPY \\DATA-SRV\D$ R:\ALL /TEE /E /R:500 /W:500 /FFT /NPĪnd then every day the robocopy command should check what are the files changed/added between the Once a month I create the ALL folder that is : My problem with this script is that Mon will contain all files. Robocopy ALL Files on a Folder called ALLĪnd create folders Mon/Tue/Wed.etc and do an incremental backup of the CHANGED / NEW Files only to those folders. So I was thinking of having the following scheme. ![]() Normally, I would need a 300GB *10 space but since we all know that no way that all data changes every day. I have around 300Gb of Data on my Server that I need to backup and keep daily copies for a 7 days (Company's Policy). ![]()
0 Comments
Leave a Reply. |