D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] Checking size of file and running command depending on size

 

>
>> Hi folks,
>>
>> I'm trying to write a bash script to check if a file is larger than a
>> certain size (say 15KB) and if it isn't to run another command.
>>
>> The closest thing I have found is the test command which can check if
>> a file exists and is bigger than 0 bytes.
>>
>> I don't suppose anyone knows how to check the file sizes and run on a
>> certain condition do they?
>>
>> Ta,
>>
>> Rob
>>
>>
>
> Not having a GNU/Linux box to hand, will the find command let you filter
> this way ??
>
>
> --
> The Mailing List for the Devon & Cornwall LUG
> http://mailman.dclug.org.uk/listinfo/list
> FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html
>

find -size +15k -exec echo {} \;

will print out a list of all files over 15k..

HTH..



-- 
When one burns one's bridges, what a very nice fire it makes.
                -- Dylan Thomas


-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html