Google
 
Web QrooniX

Wednesday, September 12, 2007

Another Find: Finding and Deleting Files Based On Date Creation

To find and delete directories:

find -type d -mtime +n -daystart | xargs rm -rf

For files:

find -mtime +n -daystart | xargs rm -rf

To be sure, we can pipe the result to a text file to double-check the files:

find -mtime +n -daystart > find-result.txt

Enjoy deleting!

Labels: ,


Friday, August 17, 2007

*Nix Tidbits

Got this error/warning while restarting Apache on FreeBSD:

No such file or directory:

Failed to enable the ‘httpready’ Accept Filter

To resolve this, issue the following command:

kldload accf_http

----------------------------------------------------------------------------------

So, some some directory was filled with thousands of files. To remove these files, you will issue:

rm -rf *

But if this error occurs:
- /bin/rm: Argument list too long

You may use use find and xarg. To do that, you can issue this command:

find . -type f -name '*string_here*' -print | xargs rm

Others may ask, why not use the -delete option instead of xargs rm? There are a lot of deployments that has an old version of find. :)

Labels: , , , , ,


This page is powered by Blogger. Isn't yours?