Monitor files being copied/accessed

Hello,

Is there a way (without 3rd party software) to know if a file has been accessed and/or copied ?

I'm interested in any solution : doing command line instructions , running background scripts etc...

I apologize if I posted this in the wrong forum.

Thank you!

IF you are linux read up on inotify in C or maybe inotifywait.
If it is a different kernel we need specifics: OS & version

Sorry about that.

Mac OS X 10.5.

Thank you about the information concerning inotify (i was interested in a linux solution too, but I prefer a Mac one, if possible).

Thank you

Apple is not like linux - there is no API. Try
Watcher

I was just reading about FSevents (google pointed me there after you told about inotify).

Thank you for your help. Maybe watcher will allow me to learn how to manipulate FSevents in order to do what i want it to do.

sudo fs_usage -e -w -f filesys |grep -i write |grep -v grep 

--this shows you what is being written to, instead of grep -i write, you could try cache_hit or just leave out the grep stuff and filter later, this is the OSX command you want I believe. It is a spin off of the Solaris dtrace utility which reads real time system calls and what not. You will learn what to filter by looking at the unfiltered output first, if you want to know what a specific process is doing, writing, etc, then grep for it, you should see the process on the left and the files being touched on the right when it's writing to a plist which is what I assume you are trying to figure out.

Yes, that's what I need. the -f network is very useful too!
Thank you!

P.S. I am new on this forum (you probably know this already ). Do I have to do something to close this thread ?

I think the mods usually take care of that.. Welcome! I find this a great place to come and learn how not smart I really am! :slight_smile:

Unix also has the find command, that can (in some shell flavors) use
-amin x (where x is accessed in past x minutes)
-atime x (where x is # days back it looks for access)