I'm trying to write a UNIX command to indicate whether any files under a subdirectory have been modified in the last 24 hours. I need it to recurse within directories as the one changed file could be many levels down. That part is easy:
The thing is this is on the slow side because it has to go through the entire directory structure. I only need a boolean true/false answer. I'd like it to stop once it finds a modified file rather than continue compiling the list. Any thoughts on a way to accomplish this?
I don't know which directory (if any) has a modified file though. If I did, I wouldn't need to run the command. If there are no matches, I understand UNIX having to look at each file. If there is a match, I feel like there should be a way to stop looking.
This doesn't work unless the top level directory is the one modified. For example, suppose I have /a/b/c. If I modify a, it works as I expected. If I modify c, it returns c. I'm thinking I have to ladd some code to look for the level of directory I want.
Depending on the filesystem, modifying a file in a directory would percolate timestamps upwards so that the parent directories would show the timestamp of the latest file modification under them.
I think probably a straight "find" can be set up to do everything, with, perhaps the help of its "printf" options, but if not, the next best thing would probably be to let find scan for files, printf out their directory paths, and "uniq" the results.
As far as the stopping part goes, I doubt that the actual timestamp checking is going to be much overhead, although if you have to do text processing to pare down returned filepaths, that could add up.
Customer surveys are for companies who didn't pay proper attention to begin with.
subject: how to find out if any files under directory recursively modified?