mardi 24 février 2015

How do I find folders containing no recently modified files?


I have a directory that gets a lot of data dumped into it, and I want to find all directories whose contents haven't been modified recently (e.g., in the last 5 days). I'm trying to compose a call to find that does what I'm looking for, but I'm starting to wonder if this is more complex than what find can handle. Here's what I've tried, which isn't doing quite what I expect:


find . -type d -d 2 -execdir bash -c 'find . -mtime -5 >/dev/null 2>&1' \; -pr une


The directory structure is laid out like $DUMP_DIR/category{1,2,3,4,5}/thing* more or less. I want to know what thing* directories have had new data dumped somewhere inside of them recently. The naive solution find . -type d -d 2 -mtime +5 will match more than I want.


I expected that the -execdir expression will find out whether any directory contains something modified in the last five days (returning nonzero if nothing is found), but I guess it doesn't quite do that.


I'm stuck with the BSD find installed on OS X. I'd also rather not install anything not already a part of the standard command line utilities. What's the most reasonable way to do this?



Aucun commentaire:

Enregistrer un commentaire