ECS Home Automation and Security Archives
  learn more | view messages for this month | NetBloc® | terms of use | search

Google
 


  subject (prev) or (next) | time (prev) or (next) | author (prev) or (next) | view more subjects

Subject:
From:
Date:
Re: [ecs] shell cmd to determine a file's size ?
Neil Cherry
Thu, 26 Feb 2004 20:57:16 -0500

Mark Gilmore wrote:

> hi rob,
> thanks, but i need to know how to branch on the condition:
>         if file sz > 0
>         ...
> 

        -e FILE
               FILE exists

        -f FILE
               FILE exists and is a regular file

        -s FILE
               FILE exists and has a size greater than zero


if [ -f File ]; then 

   if [ -s File ]; then
     echo File exist and is greater than zero
   else
     echo file exists and is empty
   fi
else
   echo does not exist
fi

-- 
Linux Home Automation         Neil Cherry        ncherry@comcast.net
http://home.comcast.net/~ncherry/               (Text only)
http://linuxha.sourceforge.net/                 (SourceForge)
http://hcs.sourceforge.net/                     (HCS II)

  subject (prev) or (next) | time (prev) or (next) | author (prev) or (next) | view more subjects




Services provided by [NetBloc]®! NetBloc Solutions Inc.
Terms of use. Indexing software (c) 1999 Lin-De, Inc
.