LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-23-2003, 03:35 AM   #1
gsbarry
Member
 
Registered: Jan 2003
Posts: 42

Rep: Reputation: 15
simple question on shell script


How can know how many items(files) are inside a folder.

I can't find that "ls" outputs any information about how many files are inside the folder
 
Old 05-23-2003, 03:51 AM   #2
jharris
Senior Member
 
Registered: May 2001
Location: Bristol, UK
Distribution: Slackware, Fedora, RHES
Posts: 2,243

Rep: Reputation: 47
Code:
ls | wc -l
Should do you, when ls is piped into another process it prints the files in a single column, wc -l (thats a lowercase L BTW) counts the number of lines it is given.

HTH

Jamie...
 
Old 05-23-2003, 04:09 AM   #3
gsbarry
Member
 
Registered: Jan 2003
Posts: 42

Original Poster
Rep: Reputation: 15
Thanks, this works
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple shell script mikz Linux - General 1 02-24-2005 07:18 AM
veprory simple but frustrating for a newbie shell script question marigb Linux - Newbie 11 04-28-2004 12:11 PM
simple shell script question. strifel Programming 7 09-13-2003 01:44 PM
simple shell script question mathfeel Linux - General 12 03-06-2003 11:23 AM
Simple C Shell script is not so simple elconde Programming 2 09-16-2001 11:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:39 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration