By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,813 Members | 1,121 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,813 IT Pros & Developers. It's quick & easy.

File monitoring for all drive

P: n/a
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/...r_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

May 24 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
rohit wrote:
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/...r_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
May 25 '07 #2

P: n/a
rohit wrote:
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
May 25 '07 #3

P: n/a
[rohit]
>>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
webpagehttp://tgolden.sc.sabren.com/python/win32_how_do_i/watch_directory_fo...
.
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
[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
May 27 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.