Re: Deleting Files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On 2012-06-20 02:11, Diego Sanchez wrote:
> find /whe/re -mtime +2 -exec echo {} \;
>
> If you get "Argument list too long" error, you can use
>
> find . -name "*" -print | xargs rm
>

Be very careful using that line!

If you have files or directories with whitespace or other special items 
in the name it can produce very unexpected behavior. In the case of 
whitespaces in filenames a better choise is to use

find . -name '...' -print0 | xargs -0 rm

Look at the man pages for find and xargs for more information.
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos


[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux