daknetworks.com

You are here: Blog Linux Delete All Files Greater than a Certain Size

Linux Delete All Files Greater than a Certain Size

Lets say you have a directory of photos. The directory is about 1TB and the hard drive is packed full. How do you delete files that are larger than a certain size?

Here's how:

cd /path/to/dir
find . -name "*.jpg" -size -3000k -delete

K is for KB.
Miss off the "-delete" if you want to run a test without deleting the files.
Adjust accordingly.

Contact Dak Networks

Please contact us at the following.