directory_monitor.pl – Monitor directory for file changes

Posted on .

I wrote this perl script to monitor a directory for changes in files such as ,

  • Created
  • Deleted
  • Modified

A directory is given on the command-line and the script continuously checks for changes until it is halted (ctrl+c).

Example output,

$ ./directory_monitor.pl /tmp/

Monitoring directory: /tmp/
(ctrl+c to halt)

20080209.145857 : test.txt Created. [0b]
20080209.145904 : test.txt Size changed to 375b (up 375b)

I was having issues with MythTV prematurely deleting recorded shows, and this script proved its worth in determining when they were deleted.

Download
  directory_monitor.pl (4.6 KiB, 5,817 hits)

5 thoughts on “directory_monitor.pl – Monitor directory for file changes

  1. Gabriel

    Great Script!

    I want to do something similar, not exactly this but your script will save the day 🙂

    Thanks!

    Reply

Leave a Reply

You may leave the Name and Email fields blank to post anonymously.