Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > deleting files based on the size

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-10-07, 11:08
sonali007 sonali007 is offline
Registered User
 
Join Date: Oct 2007
Posts: 9
deleting files based on the size

can files be deleted based on the file size??? any example is appreciated....

Thanx in advance.......
Reply With Quote
  #2 (permalink)  
Old 10-10-07, 12:28
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 2,227
Code:
find . -size 1000 -exec 'rm -f {}' \;

You may want to read the man page for find on your platform for the proper size specification.
__________________
===
Nick Ivanov
Freelance database consultant
www.datori.org
Reply With Quote
  #3 (permalink)  
Old 10-10-07, 12:57
sonali007 sonali007 is offline
Registered User
 
Join Date: Oct 2007
Posts: 9
Hi n_i,

Thanks for prompt reply....i appreciate that.....could you pls also let me know if the size which is shown when we list (ls -al) the files is in kb......you gave size as 1000, is that in kb? I want to delete files which have sizes 100 and 99.....can that be done in one shot??

Your help is highly appreciated....thanks in advance...

sonali007
Reply With Quote
  #4 (permalink)  
Old 10-10-07, 15:36
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 2,227
Quote:
Originally Posted by sonali007

Thanks for prompt reply....i appreciate that.....could you pls also let me know if the size which is shown when we list (ls -al) the files is in kb......you gave size as 1000, is that in kb? I want to delete files which have sizes 100 and 99.....can that be done in one shot??


Quote:
Originally Posted by n_i
You may want to read the man page for find on your platform for the proper size specification.
-----------------------------------------------------------------------
__________________
===
Nick Ivanov
Freelance database consultant
www.datori.org
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On