linux - finding file size for a conditional -


i'm trying write conditional statement if file greater 1gb prints name of file, in file, , skips processing it.

#!/bin/bash f in *.dmp     if [ ! $(stat -c %s $f > 1000000000) ];         name=`basename ${f%.dmp}`         if [ -f ../tshark/$name.dat ];             echo "file exists, moving on...";         else             echo "processing" $name;             tshark -pvx -r "$f" > ../tshark/$name.dat;             echo $name "complete, moving on...";         fi     else         echo $f "too large";         echo $f "\n" > toolarge.txt;     fi done 

the problem ! $(stat -c %s $f > 1000000000) isn't working.

i'd appreciate suggestions.

so, if haven't seen advanced bash scripting guide, should. yes, it's focused around bash, it's great reference things conditional.

now, you've written tries execute stat -c %s $f > 1000000000 command (it's inside parens on $() construct, equivalent old backtick, far understand. want $(stat -c %s $f) -le 1000000000 stat -c %s $f , checks if it's less or equal 1000000000. (i.e., a<=b) equivalent of !(a>b) logically.


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -