
現在、サブディレクトリを含むディレクトリを監視しており、ファイルの名前変更を検出する必要があります。私が行っているのは、すべてのファイルの md5sum を作成し、ファイル リストを別の場所に保存し、ファイルの変更が追加か名前変更かを定期的に md5sum で再度確認することです。
このプロセスは重いので、名前の変更を検出するより簡単な方法があるはずです。
答え1
試してみるといいでしょう通知ツール。Linux 系 OS の幅広い選択肢で利用できます。
これは、ディレクトリに「ウォッチ」を追加して、監視するイベントを指定することによって機能します。この主題に関する素晴らしい記事は、https://www.linuxjournal.com/content/linux-filesystem-events-inotify
マンページから:
DESCRIPTION
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
directory.
答え2
やってみました補佐官? あなたの場合には役立つと思います。
# 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]