aix unix file size comparison

Status
Not open for further replies.
i want to have a unix shell script to do the following:

if the size of fileX is < "a certain size" then
"do something"
end.

thanks in advance.

Damian
 
Try...


Code:
#!/bin/sh

# The file you're looking at
FILECHECK=myfile.dat

if [ ! -e $FILECHECK ]
then
    # echo File doesn't exist, exiting
    exit 1
fi

# Set the size you want to match against
CERTAINSIZE=1024

FSIZE=`ls -l $FILECHECK | awk '{print $7}'`
if [ $FSIZE -lt $CERTAINSIZE ]
then
    # Insert what you want to do here
fi
 
This is much simpler:
Code:
file-info:file-name = "chkfile.p".
if file-info:full-pathname <> ? and file-info:file-size < 99 then
  message "do something".

... although it isn't exactly a unix shell script ;)
 
Status
Not open for further replies.
Back
Top