Silver-0-surfer
Well-Known Member
Hi
first off, im no programmer Im just playing around here and I wasn't really sure were to post this.
I just want to run a little script that runs through a folder 'test' and removes files larger that a specific size , lets say 1 meg.
this is what I have ATM
#!/bin/sh ##I have no idea what thats for but aparently is needed
for dfile in /home/Test/* ;do ##my for do loop, running for all files in a directory
if [ $dfile -ge 1 ] ##if the file is bigger than 1 meg
then
rm -f $dfile ##delete
fi
done
I get errors like
./script: line 5: [: /home/Test/test: integer expression expected
If any of you guys know whats going on, please help. Shouldn't b 2 difficult...
first off, im no programmer Im just playing around here and I wasn't really sure were to post this.
I just want to run a little script that runs through a folder 'test' and removes files larger that a specific size , lets say 1 meg.
this is what I have ATM
#!/bin/sh ##I have no idea what thats for but aparently is needed
for dfile in /home/Test/* ;do ##my for do loop, running for all files in a directory
if [ $dfile -ge 1 ] ##if the file is bigger than 1 meg
then
rm -f $dfile ##delete
fi
done
I get errors like
./script: line 5: [: /home/Test/test: integer expression expected
If any of you guys know whats going on, please help. Shouldn't b 2 difficult...