Means of traversing a directory

Gerard Samuel fbsd-questions at trini0.org
Thu Jun 17 13:01:04 PDT 2004


On Thursday 17 June 2004 10:31 am, Richard Caley wrote:
> In article <200406170909.37669.fbsd-questions at trini0.org>, Gerard Samuel
> (gs) writes:
>
> gs> Im running tar(1) to make a tar ball of a directory using the
> gs> --newer-mtime to only get newer files after a specified date.
> gs> Unfortunately, it also creates unwanted "empty" directories.
>
> Have you tried using find?
>
> If a relative time is good enough
>
>         find DIR -type f -mtime -6
>
> if you need to specify a time and date, I think the only way is to use
> touch to makea file at the right date then use find's -newer test.

Well I made an ugly script, (50 lines), but it works.
Ill have to investigate on simplifying it, along with implementing absolute 
time with find, as that would eliminate me from using tar to get the newest 
files.
But the find commands that I used were ->

# Blatantly remove CVS directories
find -d ./ -type d -regex '.*/CVS' -exec rm -rf {} \;

# Remove empty directories
find -d ./ -type d -exec rmdir {} \;

So Im good for now.
Thanks


More information about the freebsd-questions mailing list