- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- How to list directory/sub with No. of files
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
01-24-2006 05:13 PM
01-24-2006 05:13 PM
How can I display directores & sub direcoryes (TREE) showing No. of files? will be nice to have size of each directory on the same list.
Example:
/abc 1234 10
/abc/efg 233 20
- -
- -
Thanks,
Ahmed
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2006 05:16 PM
01-24-2006 05:16 PM
Re: How to list directory/sub with No. of files
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2006 05:19 PM
01-24-2006 05:19 PM
Re: How to list directory/sub with No. of files
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=875309
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2006 05:19 PM
01-24-2006 05:19 PM
Re: How to list directory/sub with No. of files
# Change here
DIRECTORY="/tmp"
echo "Size Directory File Count"
for dir in `find ${DIRECTORY} -type d`
do
count=$(find $dir -type f | wc -l)
echo "$(du -ks $dir) $count"
done
--
Muthu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2006 05:22 PM
01-24-2006 05:22 PM
Re: How to list directory/sub with No. of files
is dealing with file counts in a file system. If you want to get directories & sub directories with file count and size then you have to use find and du to get this.
--
Muthu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2006 05:30 PM
01-24-2006 05:30 PM
Re: How to list directory/sub with No. of files
Another similat thread
http://forums1.itrc.hp.com/service/forums/bizsupport/questionanswer.do?threadId=117611
HTH,
Devender
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2006 05:36 PM
01-24-2006 05:36 PM
Re: How to list directory/sub with No. of files
Can you check the scripts, it is not working with me...
I need to list directory names with file count.
Thanks,
Ahmed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2006 05:38 PM
01-24-2006 05:38 PM
Re: How to list directory/sub with No. of files
How about this command ?
# find dir_path -depth -type f -print | wc -l
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2006 07:08 PM
01-24-2006 07:08 PM
Re: How to list directory/sub with No. of files
--
Muthu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2006 07:16 PM
01-24-2006 07:16 PM
Re: How to list directory/sub with No. of files
I'm not good in scripting ....
The error I'm getting as example ....
Size Directory File Count
./ahmed[3]: Syntax error at line 3 : `for' is not matched.
SCRIPT:
--------------------------
DIRECTORY="/tmp"
echo "Size Directory File Count"
for dir in `find ${DIRECTORY} -type d`
do
count=$(find $dir -type f | wc -l)
echo "$(du -ks $dir) $count"
----------------------------
Regards,
Ahmed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2006 07:16 PM
01-24-2006 07:16 PM
Solution#!/bin/ksh
# Change here - User input
DIRECTORY="/tmp"
echo "Size Directory File-Count"
for dir in `find ${DIRECTORY} -type d`
do
count=$(ls -l $dir | grep -E '^-' | wc -l)
echo "$(du -ks $dir) $count"
done
# END
exit 0
########
--
Muthu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2006 07:27 PM
01-24-2006 07:27 PM
Re: How to list directory/sub with No. of files
Thanks that's exactley what I'm looking for.
have a nice day.
Regards,
Ahmed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2006 05:51 PM
01-25-2006 05:51 PM
Re: How to list directory/sub with No. of files
DIRECTORY="/tmp"
echo "Size Directory File-Count"
for dir in `find ${DIRECTORY} -type d`
do
count=$(ls -l $dir | grep -E '^-' | wc -l)
echo "$(du -ks $dir) $count"
done
# END
exit 0