File monitoring for all drive

R

rohit

hi
i want to detect all file change operations(rename,delete,create....)
on ALL THE DRIVES of the hard disk
using the method ReadDirectoryChanges API , i.e program no. 3 in the
webpage http://tgolden.sc.sabren.com/python/win32_how_do_i/watch_directory_for_changes.html
..
Please suggest some modification to the program so that i can detect
changes to ALL the drives
(to detect changes on c:\ set
path_to_watch = "." to "c:\\" but this works for only one drive

thanks
rohit
 
T

Tim Golden

rohit said:
hi
i want to detect all file change operations(rename,delete,create....)
on ALL THE DRIVES of the hard disk
using the method ReadDirectoryChanges API , i.e program no. 3 in the
webpage http://tgolden.sc.sabren.com/python/win32_how_do_i/watch_directory_for_changes.html
.
Please suggest some modification to the program so that i can detect
changes to ALL the drives
(to detect changes on c:\ set
path_to_watch = "." to "c:\\" but this works for only one drive

Well, to answer the question specifically: since the
Windows filesstem has no concept of a "root" above
the drive letters, the simplest thing to do is to
kick off a thread or a subprocess or what-have-you
for each drive letter.

The *shell* has the concept of a "My Computer" which
notionally sits above the various drives, but since
it isn't itself a drive and since I assume you're
only interested in local drives anyway and not the
rest of the shell-y stuff which sits underneath it,
you'd end up querying for local drives and going
the same path in any case.

TJG
 
T

Tim Golden

rohit said:
hi
i want to detect all file change operations(rename,delete,create....)
on ALL THE DRIVES of the hard disk

But to go a little further than your question... are
you sure you want to do this? It's going to put quite
a load on your system and be not-very-scaleable. I
haven't yet had a chance to look into the NTFS
Change Journal, but that might be a better way to
go. Search this group for previous suggestions of
this sort (from me and others).

TJG
 
T

Tim Golden

[rohit]
[Tim Golden]
Well, to answer the question specifically: since the
Windows filesstem has no concept of a "root" above
the drive letters, the simplest thing to do is to
kick off a thread or a subprocess or what-have-you
for each drive letter.
[rohit]
actually i want to implement a deamon monitoring file changes on the
system
so u suggesting i should implement the program with multithreading to
include all drives?

That's one possibility, but again I'd ask whether
this is really quite sane: you're asking the filesystem
to tell you about every change to every file on the
system which will naturally slow things down. It will
get even more complicated if you're actually storing
these "change logs" in a file somewhere, since that
will then fire the monitoring mechanism itself!

I suggest - again - that the NTFS change journal might
be better suited to what you're trying to do.

Try the threaded approach with the ReadDirectoryChanges
API *on a small area of disk* to see how well it scales.
Then you'll be better placed to decide if it will work
well across all the disks in the system.

TJG
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,276
Latest member
Sawatmakal

Latest Threads

Top