[Linux-disciples] delete a whole lot of files

Adam Rosi-Kessel adam at rosi-kessel.org
Wed Feb 7 13:16:22 EST 2007


On 2/7/2007 1:05 PM, Stephen R Laniel wrote:
> When you want to delete a lot of files, your best bet is to
> use the 'find' command. E.g.,
> find /home/church -iname '*.jpg' -print0 -exec rm \;

I think you would need

find /home/church -iname '*.jpg' -print0 -exec '{}' rm \;

But, anyway, you can easily delete by size:

find /home/church -iname '*.jpg' -size -500k print0 -exec rm '{}' \;

Really, I would recommend moving rather than deleting because it can be
harder to recover multiple times:

find /home/church -iname '*.jpg' -size -500k print0 \
		-exec mv '{}' ~/trash_dir \;

Or even:

find /home/church -iname '*.jpg' -size +500k print0 \
		-exec mv '{}' ~/good_dir \;

(take out all those files bigger than 500K)


More information about the Linux-disciples mailing list