I am currently monitoring directories with subdirectories, and I need to detect file rename. what I do is making a md5sum of all files and a keep a file list on another place, and from time to time check again md5sums if files changes are additions or rename.

This process is heavy, I guess there must be a simpler way to just detect rename.

  • What OS are you using? – SHawarden May 26 at 21:46
  • linux, ubuntu or debian flavor but the solution may need to works on other distro. – dominix May 26 at 21:47
  • You imply three times you only want to detect renames, but once you say "if files changes are additions or rename". Which is it? If it's just renames, then there is no reason to use checksums. Just compare the file names. – Sparhawk May 26 at 23:54
  • I never say 'only' ... I need to detect rename in directories where there is files rename and addition. – dominix May 27 at 0:27

Have you tried aide? I think it will help in your case.

# apt install aide     [On Debian/Ubuntu]
# yum install aide     [On RHEL/CentOS]     
# dnf install aide     [On Fedora 22+]
# zypper install aide      [On openSUSE]
# emerge aide              [On Gentoo]

You could try the inotify tools. It is available in a wide selection of Linux-like OSes.

It works by adding a "watch" to a directory, specifying events to listen for. A lovely article on this subject can be found at https://www.linuxjournal.com/content/linux-filesystem-events-inotify

From the manpage:

       The  inotify  API  provides  a mechanism for monitoring file system events.  Inotify can be used to monitor individual files, or to
       monitor directories.  When a directory is monitored, inotify will return events for the directory itself, and for files inside  the

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.