Hi,
I'm trying to remove the oldest file (whenever there's 14 or more):
Code:
FILECOUNT=`ls | wc -l`;
if [ $FILECOUNT > 14 ]
then
cd "$PATH" && ls -tr | head -n 1 | xargx rm -f;
echo "Removed oldest file ...";
else
echo "No 14 files in the filesystem yet, nothing to remove";
fi
I keep getting the following error though:
./mysqlbackup: line 1: ls: command not found
./mysqlbackup: line 1: wc: command not found
No 14 files in the filesystem yet, nothing to remove
Can anyone tell me what I'm doing wrong here ?
Thnx in advance !