Hello,
I'm trying to find files then pipe that into a command that would delete the listed files.
find ./ -atime +3. What would be a good way to delete the files without having to pipe the output to file then deleting the files.
there's a delete example on the find manpage actually -- but *do* go careful please <smile> [sig]<p>Mike<br><a href=mailto:michael.j.lacey@ntlworld.com>michael.j.lacey@ntlworld.com</a><br><a href=
find ./ -atime +3 -exec rm -i {} \;
will find the files, and execute rm interactively, you could leave the argument off, but that's more risky. [sig]<p>Jon Zimmer<br><a href=mailto:b0rg@pcgeek.net>b0rg@pcgeek.net</a><br><a href=
You can try [tt]find / -atime +3 -type f -print | xargs -p rm[/tt], resulting in a execution of rm command for many files, not for each and every file.
Elgis -- If I read that right it would delete every file on the system older than three days, is that correct? [sig]<p>Mike<br><a href=mailto:michael.j.lacey@ntlworld.com>michael.j.lacey@ntlworld.com</a><br><a href=
speaking from experience, it is always a good idea to test any advice before you use it.
Try running the find without rm to see what comes out of the search.
Also, when you are bulk deleting it is always a good idea to backup first. [sig]<p>Ged Jones<br><a href=mailto:gedejones@hotmail.com>gedejones@hotmail.com</a><br><a href= > </a><br>Top man[/sig]
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.