Delete All *.exe Files Depending on FileSize

Hi, what command line to delete all *.exe files depending on filesize, eg. i want to delete all *.exe with filesize = 1000 bytes?
LVL 3
wuyinzhiAsked:
Who is Participating?
 
Abhishek_ChibConnect With a Mentor Commented:
yes you can define exact bytes:

For auto delete :

use :

find / -name '*.exe' -size +1K -exec rm -rf { }\;

0
 
Abhishek_ChibCommented:
Log on via root :

this command will generate the list

find / -name '*.exe' -size +1K

After that, you can delete file whatever you want
0
 
wuyinzhiAuthor Commented:
thanks, but since i'm new in linux, can i define exact bytes instead of +1K?
also, what should i do after i get the list? should i rm manually per-line?
0
 
Joseph GanSystem AdminCommented:
Yes, you can define the size exact bytes, eg. 1000bytes will be 1000nc. So the command is:
# find / -type f -name *.exe -size 1000nc -exec rm -f {} \;
0
 
wuyinzhiAuthor Commented:
many thanks ganjos
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.