I'm working on a project trying to auto-bookmark folders based on how frequently a folder/directory is visited. I have searched exhaustively as to how to monitor folders visited by the current user. Can anyone guide me as to how to construct a script for doing the same?

Language restrictions : C or Java. Maybe python.


Install inotify-tools and you can play around with inotifywatch and inotifywait. The first logs all activity, the second breaks on certain activity. Both work well but obviously which you want depends on what you're doing.

A simple bash to show the first operation inside a directory is:

$ inotifywait -r .
./path/to/ OPEN file.ext

Note if it's a big dir, setting up all the listeners takes a while.

For better scripting access, look at pyinotify or just look at the C headers for inotify-tools.

Your Answer

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