Optimized monitoring of files and parents