[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Delete All *.exe Files Depending on FileSize

Posted on 2011-04-20
5
Medium Priority
?
434 Views
Last Modified: 2012-08-13
Hi, what command line to delete all *.exe files depending on filesize, eg. i want to delete all *.exe with filesize = 1000 bytes?
0
Comment
Question by:wuyinzhi
  • 2
  • 2
5 Comments
 
LVL 3

Expert Comment

by:Abhishek_Chib
ID: 35438327
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
 
LVL 3

Author Comment

by:wuyinzhi
ID: 35438344
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
 
LVL 3

Accepted Solution

by:
Abhishek_Chib earned 2000 total points
ID: 35438357
yes you can define exact bytes:

For auto delete :

use :

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

0
 
LVL 16

Expert Comment

by:Joseph Gan
ID: 35438368
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
 
LVL 3

Author Comment

by:wuyinzhi
ID: 35438382
many thanks ganjos
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses
Course of the Month20 days, 4 hours left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question