- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- HP-UX empty directories?
Operating System - HP-UX
1823753
Members
3972
Online
109664
Solutions
Forums
Categories
Company
Local Language
юдл
back
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
Forums
Discussions
юдл
back
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
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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-18-2002 06:08 AM
тАО08-18-2002 06:08 AM
HP-UX empty directories?
I'm doing some scripting on an HP-UX system, and one of the checks I'd like to make is to check whether a directory is empty or not. However, I've encountered some strange behavior. As I understand it, most Unix's implement the directory filetype as a binary listing (one per line) of the items contained therein, correct? A typical empty directory should then be 96 (for HP-UX only) bytes. As the number of files increases in the directory, the size of the directory itself should also grow, correct? On HP-UX systems, however, I've been finding several directory names that have somewhat large sizes (13K), and yet are still empty; `ls -al` says 'total 0'. When I run the `strings` command on the directory names I get a listing of several older files that are no longer in the directory. Any idea why the directory name isn't clearing the names out of itself as the files are deleted? Is this normal?
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-18-2002 06:38 AM
тАО08-18-2002 06:38 AM
Re: HP-UX empty directories?
Yes, this is normal behaviour. Under HP-UX, the directory size can increase, but not decrease.
If you do a search on the forums, for "empty directory size", you should be able to pick up more details (unfortunately, when I try at the moment, I get an "unable to log in" message, as it's trying to point me to the US site).
If you do a search on the forums, for "empty directory size", you should be able to pick up more details (unfortunately, when I try at the moment, I get an "unable to log in" message, as it's trying to point me to the US site).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-18-2002 07:58 AM
тАО08-18-2002 07:58 AM
Re: HP-UX empty directories?
So, better to write a new script, like:
for i in `find . -type d -exec ls -d {} \;`
do
size=`ls -la $i | wc -l`
let size=size-3
if [ $size -eq 0 ]
then
echo "empty dir : $i
fi
done
Regards,
Ceesjan
for i in `find . -type d -exec ls -d {} \;`
do
size=`ls -la $i | wc -l`
let size=size-3
if [ $size -eq 0 ]
then
echo "empty dir : $i
fi
done
Regards,
Ceesjan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-18-2002 10:31 AM
тАО08-18-2002 10:31 AM
Re: HP-UX empty directories?
Hi,
UN*X (any flavour of) cannot shrink directories. And file-entries in a directory are *deleted* by assigning the reserved inode-number 0 to them, so the names stay in there - until they are overwritten by a new file-entry.
So, to find *empty* directories you will have to check wether they only contain "." and ".." and nothing more!
HTH,
Wodisch
UN*X (any flavour of) cannot shrink directories. And file-entries in a directory are *deleted* by assigning the reserved inode-number 0 to them, so the names stay in there - until they are overwritten by a new file-entry.
So, to find *empty* directories you will have to check wether they only contain "." and ".." and nothing more!
HTH,
Wodisch
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Learn About
News and Events
Support
© Copyright 2025 Hewlett Packard Enterprise Development LP