Re: Monitoring filesystem for file/folder changes
by wazoox (Prior) on Jun 04, 2005 at 21:20 UTC
|
There is this neat tool, FAM (File Alteration Monitor) for which it exists an old module, SGI::FAM. However, FAM won't work on all systems; IRIX and Linux for sure, FreeBSD if I recall correctly, Win32 surely not.
However, I wonder if this would be a viable solution to monitor a whole filesystem; this sort of stuff works pretty well to monitor a few files or folders, but to monitor everything you'll need some sort of plugin at the VFS level, similar to those used by antivirus softwares.
However if you can accomodate with FAM limitations, it's a nice and efficient tool, and perhaps it deserves a closer look. I suppose the SGI::FAM is IRIX only, may it be easily ported to Linux/others? I don't know... | [reply] |
|
SGI::FAM definitely works well on Linux. Can't comment on bsd, but it's definitely not IRIX only.
| [reply] |
|
"plugin at the VFS level, similar to those used by antivirus softwares."
Yeah, something like that was what I was hoping for... Seems unavailable though... :(
| [reply] |
|
| [reply] |
|
As usual, there is more than a way to do it.
Someone was mentioning AntiVirus technology. Well, on GNU/Linux and FreeBSD there is an opensource module Dazuko that comes with a Perl module (surprise!) to interface with it.
This means that it is trivial to hook into the kernel and find out in real time when a file changes.
This means that you know "instantly" when a file is added or changed.
It may be way too much for what you want, but it can also suit your needs.
P.S.: using the module without care can be Dangerous .
| [reply] |
Re: Monitoring filesystem for file/folder changes
by jpeg (Chaplain) on Jun 04, 2005 at 21:45 UTC
|
| [reply] |
|
First, sorry, forgot to login for the reply above. And yea, found that, and I suppose Im gonna use that for the Windows version of my app. One question about this though... Is it heavy use to monitor.. say D:/ which contains 2000+ files and like 500 folders? Guess how that module actually "monitors". If it goes recursivly, I can almost do that myself, but then Im back to square 1.
| [reply] |
|
I've used it, and it's certainly not 'heavy'.
I guess (haven't looked at the code) that it uses some Win32 APIs, so I doubt it does anything as crude as building a recursive tree. I don't know if it's built the same way, but check out Sysinternal's Filemon utility for a description of a smart way to build something like this. Win32::ChangeNotify has done the heavy interface work for you already, why not use it?
| [reply] |
|
|
Ok, how do I get the reason and file when this is triggered??? This DirMon.pl script I get links to in google groups aint helping since it seems this code adds all info into some hashes (recursivly!) and use this to check later when triggered, for the selected dirs to monitor. So, no use of that at all. I dont get it. Why not return that info somehow in the module?
| [reply] |
|
Ok, found, installed and gonna test Win32::AdvNotify instead! Seems to support returning WHY something happend!
| [reply] |
Re: Monitoring filesystem for file/folder changes
by wolv (Pilgrim) on Jun 05, 2005 at 19:56 UTC
|
On Linux, there is inotify, which lets you monitor directory trees efficiently. There is a Perl module for it. A low-level C tutorial can be found at IBM developerWorks. | [reply] |
Re: Monitoring filesystem for file/folder changes
by sh1tn (Priest) on Jun 04, 2005 at 21:52 UTC
|
In addition to the above answers, under UNIX you have locate file indexer.
| [reply] |
|
Ah, yea. Know about that too... I guess mostly this is better use for Windows... but I like doing my apps so they work on as many OSes as possible. But I guess my app gonna have some more functions to it compared to locate. ;) This since I have quite alot of control of whats saved into db and what queries to do. Besides, my app have a GUI, where the user is gonna easly delete a full folder. Oh, and yea, one can open files directly from the search result GUI. Etc etc ;)
| [reply] |
|
Commercial homework? Nice idea, still 'homework'.
| [reply] |
|
Re: Monitoring filesystem for file/folder changes
by johnnywang (Priest) on Jun 05, 2005 at 17:16 UTC
|
Isn't this the desktop search that every of those "big boys" are doing: google, yahoo, microsoft? Incidentally is there an open source implementation of desktop search? in any language? I interviewed someone last year who was doing it in java, he actually spent two years working on it, apparently the big boys killed his business, or his supporters' interest. | [reply] |
|
Hehe, I suppose.. Sort of. Kinda fun that way. I dont mind google. They are impossible to beat anyway (dont have 10000000+ Pcs in an array exactly...), and I like google! M$? Well, its funny... the thing I've done is REALLY fast (thanx to mySQL/SQLite). Basic and simple thing this, really, but I havent seen anyone doing it, so I thought I do it myself! The "bigboys" aint "done" yet as far as I know. I mean, have they released anything yet to use? Besides, Im not sure they gonna make it _that_ interactive as I want it to be (you can klick findings and delete/run them?). How about finding just a particular folder? (no file, no path, JUST FOLDER!) Delete the whole chosen dir? Well, thats the 'basics' the app can do now... Later on it can be more complicated queries... Natrually, if this was in the OS, some of these interactive things would be kinda build in already...
And yea, M$ was supposed to have this new db filesystem in Longhorn, but apparently that is also taken out (WinFS). Too bad M$...
| [reply] |