Skip to main content
Question

What's a good approach to detecting when files in a directory are replaced with files of the same name (size can be different)?

  • August 3, 2020
  • 3 replies
  • 27 views

Forum|alt.badge.img

We have a folder of pdf files where we want to be able to track two things -

  1. when a new file is added
  2. when an existing file is replaced with a file of the same name.

 

We have 1) working (using Directory Watcher). But I'm not sure of the best way to approach 2). I guess we could look out for situations of 1) where the file count in the directory has also increased. But I'm not clear how to accomplish that or whether that's the best approach.

 

Incidentally, these files are project drawings. And our business practice is such that when as-built info is added to the drawings, they get re-scanned and the existing file gets replaced with this new scanned file.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

3 replies

redgeographics
Celebrity
Forum|alt.badge.img+60
  • Celebrity
  • 3704 replies
  • August 4, 2020

The Directory Watcher can be set to check for Modify as well, that should pick up case 2


virtualcitymatt
Celebrity
Forum|alt.badge.img+47
  • Celebrity
  • 2000 replies
  • August 4, 2020

The Directory Watcher can be set to check for Modify as well, that should pick up case 2

Yep, I agree that this should work. I *think* that the DirectoryWatch uses a change in file size to detect a modification rather than the Date Modified but I could be wrong there.


Forum|alt.badge.img
  • Author
  • 36 replies
  • August 4, 2020

I tried that approach but it doesn't seem to work. When you overwrite a file with a file of the same name, I noticed that (in Windows in any case) the Date Created reflects the time the file was overwritten. So it considers it a CREATE, not a MODIFY.