Everything you ever wanted to know about directories under UNIX! ---------------------------------------------------------------- Under UNIX directories are a special (OS writable only) files. The file is a unsorted linked list of Filenames to file-inode (attributes and location of file on hard disk) This directory file will thus be different on one disk to a perfect copy of that directory file on another disk (different machine or not). Entries may be in a different order (it isn't sorted remember) and inode addresses to copies of files will also be different. Also under UNIX directory size will always increase to be large enough to hold all the file entries in that directory. If the number of files latter shrinks the directory size WILL NOT SHRINK! So if you create a directory, place 40,000 files in it, then remove all the files. The directory file will be very large even though the directory is empty. The only way to make a directory file smaller is to create a new one MOVE the files to the new directory. Delete the old (now empty) directory. And rename the new directory the same as the old one. NOTE: move (or rename, which is the samething) under unix on the same hard disk partition does not physically move the file, only the files directory entry link so is very fast and cheap (it is also basically an atomic operation). For moves involving seperate partitions the file data itself has to be copied and old data removed, which can take some time.