Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Count files existing in my current directory with extention .log. 1

Status
Not open for further replies.

bhagabati

Programmer
Apr 8, 2003
8
AU
I need to count files existing in my current directory with the file extention of *.log.* so that I can initialise using the loop like

x=0
while [ $x -lt $num ]
do
> $(eval echo \$$i).log.$x
x=`expr $x + 1`
done

How can I do it please give me a quick tips.
 
x=`ls -1 *.log | wc -l`

first option is "minus one"
second option is "minus lower case L"
 
Thanks Salem for your quick response.
It works and solves my problem now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top