linux - How can I detect if some file in a subdir changed? -
basically have big directory (>10gb)(each subdir has few other subdirs) , want sth files changes. can't go through files , check, because takes long , uses 90% of cpu :(.
this how looks basically:
dir dir/suba dir/suba/subasuba dir/suba/subasubb ... dir/subb dir/subb/subbsuba dir/subb/subbsubb ... dir/subc dir/subd ... my thought this(file "test" in subbsuba chaged):
check dir -> dir changed -->check suba -> suba didn't change -->check subb -> subb changed --> check subbsuba -> subbsuba changed --> check files but sadly change of file effects modification date of direct parent directory :(
as @aereaux pointed out need inotify, available in linux since 2.6.13. see http://en.wikipedia.org/wiki/inotify
there inotify-tools available command line usage well. http://techarena51.com/index.php/inotify-tools-example/
Comments
Post a Comment