471,066 Members | 2,150 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,066 software developers and data experts.

File monitoring for all drive

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
3 3580
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
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
[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.

Similar topics

reply views Thread by simpsoro | last post: by
12 posts views Thread by Anders Eriksson | last post: by
7 posts views Thread by Mark | last post: by
reply views Thread by Ron Simpson | last post: by
5 posts views Thread by Joe | last post: by
reply views Thread by mr t | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.