[Ilugc] HOW TO KEEP A LOG OF DELETED FILES ?

  • From: roshan@xxxxxxxxx (Roshan George)
  • Date: Thu Feb 11 13:51:37 2010

On Thu, 2010-02-11 at 06:51 +0000, swapan karmakar wrote:

IS IT POSSIBLE TO MAINTAIN A LOG OF FILES DELETED , IN LINUX ?

Dude, I think your Caps Lock key is stuck. Anyway, you can write
something using inotify to do what you want. If you're feeling lazy and
have some idea of what files you want to watch then use inotifywait from
inotifytools. Put it in a shell script and enjoy.

Here's an example of how inotify works

        $ touch cow
        $ inotifywait -m cow
        Setting up watches.  
        Watches established.
        cow MOVE_SELF 
        cow ATTRIB 
        cow DELETE_SELF 
        cow IGNORED 

That happens when I ran the following in another pty:

        $ mv cow pig
        $ rm pig

You can make it do all sorts of more complicated things if you want to.
Have fun.

-- 
Roshan George <roshan@xxxxxxxxx>

Other related posts: