스냅샷 없이 파일 이름 변경을 감지하는 방법

스냅샷 없이 파일 이름 변경을 감지하는 방법

현재 하위 디렉터리가 있는 디렉터리를 모니터링하고 있으며 파일 이름 변경을 감지해야 합니다. 내가 하는 일은 모든 파일의 md5sum을 만들고 파일 목록을 다른 곳에 보관하는 것입니다. 그리고 때때로 파일 변경 사항이 추가되거나 이름이 바뀌었는지 md5sum을 다시 확인합니다.

이 프로세스는 무겁습니다. 이름 변경을 감지하는 더 간단한 방법이 있어야 할 것 같습니다.

답변1

당신은inotify도구. Linux와 유사한 다양한 OS에서 사용할 수 있습니다.

디렉터리에 "watch"를 추가하고 수신할 이벤트를 지정하는 방식으로 작동합니다. 이 주제에 대한 멋진 기사는 다음에서 찾을 수 있습니다.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]

관련 정보