- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: finding zero kb 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
08-26-2009 11:57 PM
08-26-2009 11:57 PM
finding zero kb files
and need to know how many files present,,, how can i do it
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2009 12:41 AM
08-27-2009 12:41 AM
Re: finding zero kb files
You could use "ls directory | wc -l" to count the files.
You could use awk to do both:
ll directory | awk '
BEGIN { count = 0 }
NF >= 9 {
count += 1
if ($5 < 512) print $0
}
END { print "Total files:", count } '
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2009 12:54 AM
08-27-2009 12:54 AM
Re: finding zero kb files
cd /mydir
find . -size 0 -type f
and of course for a total:
cd /mydir
find . -size 0 -type f | wc -l
of course that find will walk sub-dirs, so if you want to exclude those try:
cd /mydir
find . \( ! -name . -prune \) -size 0 -type f
and
cd /mydir
find . \( ! -name . -prune \) -size 0 -type f | wc -l
My find syntax is pretty lame though, so there may be a better way to get that...
HTH
Duncan
I am an HPE Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2009 01:02 AM
08-27-2009 01:02 AM
Re: finding zero kb files
You could remove the \( \), since the default is "-a".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2009 01:58 AM
08-27-2009 01:58 AM
Re: finding zero kb files
find / -size 0 -exec ll {} \;
Regards
sunny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2009 01:48 AM
08-28-2009 01:48 AM
Re: finding zero kb files
cd
ls -l|awk '$9&&!$5 {print $0;i++} END { print i}'
HTH,
Art