[TriLUG] `find -delete` not deleting

Joseph Mack NA3T via TriLUG trilug at trilug.org
Tue Sep 6 12:33:51 EDT 2016


On Tue, 6 Sep 2016, Lance A. Brown via TriLUG wrote:

> TEST this before using!
>
> Something like:
>
> find $top_dir -mtime +7 > /tmp/delete.$$ && xargs /bin/rm -rf <
> /tmp/delete.$$ && /bin/rm /tmp/delete.$$

oh me oh mi

> That way you capture the list of files/directories to delete to a file,
> delete them, then remove that file.  This avoids changing the mtime on
> the directories.

Hi Lance,

I'm trying this

find $top_dir -maxdepth 2 -mtime +7 -type d -exec rm -rf  {} \;

the directories I want to delete are 2 levels down from $top_dir, I assemble the 
list of directories and then `rm -rf` them.

I don't have any directories left from 7 days ago (I scrubbed them), but if I 
change the +7 to +6, then when I run the above command, I don't have any 
directories from 6 days ago with today's date.

I'll watch it for the next couple of days.

Thanks
Joe

-- 
Joseph Mack NA3T EME(B,D), FM05lw North Carolina
jmack (at) austintek (dot) com - azimuthal equidistant
map generator at http://www.wm7d.net/azproj.shtml
Homepage http://www.austintek.com/ It's GNU/Linux!


More information about the TriLUG mailing list