Unix questions - How to delete all files with a file size lower equal 210 bytes?

This is Interesting: Free IT Magazines  
Home > Archive > Unix questions > March 2005 > How to delete all files with a file size lower equal 210 bytes?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author How to delete all files with a file size lower equal 210 bytes?
Matthias Zach

2005-03-17, 5:55 pm

I want to delete all files in a certain directory (say /var/users/karl )
which have a file size lower equal 210 bytes.

How do I do this in a shell script (with one command)?

Matt

Bev A. Kupf

2005-03-17, 5:55 pm

On Thu, 17 Mar 2005 18:02:41 +0100,
Matthias Zach (zach228@fortuencity.com) wrote:
> I want to delete all files in a certain directory (say /var/users/karl )
> which have a file size lower equal 210 bytes.
>
> How do I do this in a shell script (with one command)?


Since you've posted this to comp.os.linux.misc, you presumably
have GNU find. If that's the case, you should be able to use
something like:

`find . -size -211c -exec rm {} \;`

or some variant thereof.

Beverly
--
Many a smale maketh a grate -- Geoffrey Chaucer
Bev A. Kupf

2005-03-17, 5:55 pm

On Thu, 17 Mar 2005 17:48:15 GMT,
Bev A. Kupf (bevakupf@myhome.net) wrote:
> On Thu, 17 Mar 2005 18:02:41 +0100,
> Matthias Zach (zach228@fortuencity.com) wrote:
>
> Since you've posted this to comp.os.linux.misc, you presumably
> have GNU find. If that's the case, you should be able to use
> something like:
>
> `find . -size -211c -exec rm {} \;`


Oops, make that: `find /var/users/karl -size -211c -exec rm {} \;`

> or some variant thereof.
>
> Beverly

--
Many a smale maketh a grate -- Geoffrey Chaucer
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com