Monday, 24 December 2018

Linux: Find And Delete Files Greater Than Given Size

If you want to delete files which are greater than given size on Linux, you can use below examples by changing as your need.

Delete Files


Delete files which are size more than 2 MB. and type is jgp.

[root@testserver ~]# find /tmp/ -type f -size +2M -name “*.jpg” -exec rm -rf {} \;

Delete files which are size more than 2 MB low than 5 MB. and type is jpg.

[root@testserver ~]# find /tmp/ -type f -size +2M -size -5M -name “*.jpg” -exec rm -rf {} \;

Delete files which are size low than 10 MB. and type is zip.

[root@testserver ~]# find /tmp/ -type f -size -10M -name “*.zip” -exec rm -rf {} \;

0 comments:

Post a Comment