- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Counting number of files into a directory
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2001 05:49 AM
08-13-2001 05:49 AM
Counting number of files into a directory
I do not remember the way to count the number of files and subfolders stored into the same directory.
Could anybody help me?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2001 05:54 AM
08-13-2001 05:54 AM
Re: Counting number of files into a directory
you can use this:
find
or for files only:
find
or for subdirs only:
find
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2001 05:54 AM
08-13-2001 05:54 AM
Re: Counting number of files into a directory
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2001 05:55 AM
08-13-2001 05:55 AM
Re: Counting number of files into a directory
go to the directory and use this for counting regular files:
find . -type f | wc -l
and this for counting directories:
find . -type d | wc -l
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2001 05:57 AM
08-13-2001 05:57 AM
Re: Counting number of files into a directory
One way is this:
For files:
# ls -lR mydir|grep ^-|wc -l
For directories:
# ls -lR /tmp|grep ^d|wc -l
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2001 05:58 AM
08-13-2001 05:58 AM
Re: Counting number of files into a directory
Sorry, the uniform example I meant used "mydir" in both cases!
One way is this:
For files:
# ls -lR mydir|grep ^-|wc -l
For directories:
# ls -lR mydir|grep ^d|wc -l
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2001 05:58 AM
08-13-2001 05:58 AM
Re: Counting number of files into a directory
#find . -type f |wc -l
gives you the no. of files existing in the present directory.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2001 06:11 AM
08-13-2001 06:11 AM
Re: Counting number of files into a directory
how about "cd
HTH, Edgar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2001 06:54 AM
08-13-2001 06:54 AM
Re: Counting number of files into a directory
Try this
find . -depth -print | wc -l
Manoj Srivastava