I want to create a backup Batch file that meets these requirements:
Requirement:
1-Only copy the source files if the source file got modified. 2-If the destination contains the files/folders that do not exist in the source, then the destination files/folders will be deleted. 3-Copies all subdirectories, even if they are empty. 4-If something happened that make the coping process uncompleted (ie copied unsuccessfully), the program will revert & keep the old version of the destination folder. 5-The batch file should run at the time i turn off my PC or at 7pm Daily.
So, i tried this
xcopy C:\MyProject N:\backup\MyProject /V /Y /E /D
Note: /v=Verify, /y=No prompting /e=subdirs /d=Copy only changed
However, after running the batch, it did not delete the files/folders mentioned in requirement 2. Also, i don't know how to do the requirement 4 & 5.
I searched many questions but seem they didn't have the code to meet requirement 2 & 4 & 5.
I don't want to use backup tool in Win7 since it is very heavy & it requires a big backup disk space. I prefer something simple (why didn't Window make things simple?? ).
Backup is very important when u do the project, I hope my question will help a lot of other programmers.
Can anyone know a good solution for this?