How can i remove a file using shell script when its size exceeds 10MB. Given that file is located in different location to the shell script where it is running?
You don't mention what OS you're using but some versions of find have a "-size" flag:
find /somewhere -type f -size +10M -exec rm -f {} \;
Thanks for your help. Please help me to implement this in a if condition.
Say,
if[file_size > 10MB]
then
rm file_name*.txt
fi
file_size=$( stat -c %s /your/file )
if [ $file_size -gt 10000 ]
then
rm /your/file
fi
--ahamed
Thanks a lot ahamed..