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, Unix implements the directory filetype as a binary listing (one per line) of the items contained therein, correct? A typical empty directory should then be 96 (or some other standard size depending on your distribution) bytes. As the number of files increases in the directory, the size of the directory itself should also grow, correct? On several 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 (which may be an HP-UX-only implementation. All it does is output the any printable strings of a binary to the screen) 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?




Reply With Quote