0

For a solution, I'm looking for a basic tool that can copy files from location A to B. There is one major rule for this:

Only files in location A that where not there the last time the tool ran, need to be copied to location B.

I've looked into Robocopy. I saw the option to copy files from A to B. However, in location B, the files are deleted after they have been used. So robocopy keeps copiying them every time. I only need to have new files in location B.

Hope this is clear and there is a solution for my challenge.

  • 1
    This won't work with most tools if you don't keep a history as you're deleting the files in the destinations. Alternatively you'd have to be selective about the timeframe and e.g. only run once every so often and only copy files since the last run. Which is very different from a regular sync. – Seth Feb 21 '20 at 10:52
1

Files on Windows have an 'Archive' attribute which is set on creation and every time the file is modified.

You can use Robocopy with the /m option to only copy those files which have +A set and automatically unset it after copying. The next time you run robocopy /m it will skip the already-copied files.

(Note that +A is also set when the file is moved or renamed – but not when the parent directory is moved or renamed.)

  • this solution did work locally. Does this require write-access on file location A side to change attribute status? – Sunfile Feb 21 '20 at 15:23
  • 1
    Yes it does, although if you're asking in terms of NTFS ACLs then "write attributes" can be granted independently from "write data". – user1686 Feb 21 '20 at 15:31
0

You need to use switchs :

/maxlad:Specifies the maximum last access date (excludes files unused since N).

/minlad:Specifies the minimum last access date (excludes files used since N) If N is less than 1900, N specifies the number of days. Otherwise, N specifies a date in the format YYYYMMDD. the info in this link may help: Robocopy command to copy updated files and long path names

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.