I’m creating a library for testing purposes that spawns a large amount of dummy files that will most likely be moved around and renamed. I would like my library to keep track of the files so that I can remove them (or reset them) after testing is complete. I am also going to store changes made to these files for logging purposes.
Is it possible to detect when a File or Directory moves, or is renamed and detect where they were moved to in the scope of a script?
Bonus
Is it possible to detect when a new file is created in a specific directory(non-recursive)?
The inotify facility in Linux can probably help with what you want to do. I don’t know whether there is specifically a Ruby interface to inotify, though (however, a quick search turned up ruby-inotify example?).