Our requirement is to copy files from source to the destination folder.
The clause is during the first run of the script everything should be copied but in the subsequent runs it should copy only those files which have not been copied till yet and are new ones.
The issue is from the destination folder we have a script that works on the files and remove them once executed. So we dont want duplicate files from source copied to destination.
Example
source-> abc.txt,def.xt
after 1strun
dest->abc.txt,def.txt
subsequent runs
source->abc.txt,def.xt, ghi.txt
dest->abc.txt,def.xt, ghi.txt
Now when another script has worked on dest folder and removed abc.txt and ghi.txt then the logic should be
source->abc.txt,def.xt, ghi.txt,jkl.txt
Now when the script runs it should only copy the new files
dest->ghi.txt, jkl.txt
I was thinking if we can log the output after the script is run for the first time to a txt file and then put a condition to check in that log file if the text file is there before copying anything from the source folder to the destination .
Hope was able to explain.
Thx
robocopy. It was made for this kind of task. - Ansgar Wiechers/mcopies all source files where thearchiveattribute is set. If you want to exclude files that already exist in the destination use/xx(exclude extra files). If you want to exclude files that have been copied to the destination at any point in the past, regardless of whether or not they still exist in the destination, you will indeed have to use a custom script and a copy history. - Ansgar Wiechers