Jump to content

[NOW WORKING] a (broken) monitor file changes script which uses ReadDirectoryChangeW


Zomp
 Share

Recommended Posts

  • 2 months later...
  • Replies 63
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

...

Excellent work Jackchen & All!

Ran some tests and here are my observations...

Minor...

  • Renaming a monitored folder is not triggered as a change although the changes within the renamed folder are retained. IMO This is both a good and bad thing.
  • If the folder NTFS permissions change in a way that prevent access to the folder after the monitor was started, the changes are triggered.
  • If the folder NTFS permissions change in a way that prevent access to the folder before the monitor was started, the changes are not triggered.
  • If the folder NTFS permissions change in a way that allow access to the folder after the monitor was started, the changes are not triggered.
  • If a sub-folder is a NTFS Junction to another folder not within the sub structure of the monitored folder, the changes are not triggered.
  • If a sub-folder is a NTFS source junction to a folder not within the sub structure of the monitored folder, the changes are triggered.
Major...

  • Removing of the folder causes the event trigger to enter an apparent infinite loop, repeating the last change.

For my purposes, the minor issues are not going to be a problem. However, the folder deletion issue is an defiantly a problem. I'm going to dig into the code and see if I can resolve it myself but I'm also calling the crowd to take a look as well.

--- TTFN

Link to comment
Share on other sites

  • 2 months later...

Is it possible to have something that will show in real time all existing files and directories in some directory and hide any deleted files and directories?

What I'm trying to do is to watch some directory and see only existing files and directories recursively in real time.

I need the option: Created...

I don't need the option: Modified...

Instead of "Deleted..." option I need to remove the line "Created..." for the deleted file.

I'll try to explain it from my view:

Lets say I have directories "c:\test\1" "c:\test\2" and files "c:\test\1\A" "c:\test\1\B" "c:\test\2\A".

When program starts I need to scan folder in real time for existing data and show them all.

Then let's say I'll delete the "c:\test\1\A" I need the created line "Created... c:\test\1\A" from before to disappear.

Thanks.

Ps. I found:

It seems that's doing my job.

Edited by Demetris
Link to comment
Share on other sites

  • 11 years later...

Hi there

This is a awesome script. Thanks a lot.

I'm currently on a project where we should monitor multiple folders for new PDF-Files. If there is a new file, run an ocr and save it to another location.
As long as there is only one source it works great. Processing a PDF normally takes about 10 to 20 seconds. Even if we copy multiple PDF to the source, all the files are picked up and are processed by ProcessWaitClose()

The problem starts if there are multiple folders monitored. If I for example copy 3 PDFs to C:\test01 the script starts to pick them up and processing them. During this i copy 3 other PDFs to C:\Test02. These are not picked up because the function _MonitorDirectory() returns "Modified" instead of "Created".

Is this a known issue or do any one have a solution for this?

Thanks a lot again for the script provided and for any ideas on how to fix my problem.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...