Operating System - HP-UX
1834118 Members
2598 Online
110064 Solutions
New Discussion

Max number of files on directory

 
SOLVED
Go to solution
Jimmy_13
Advisor

Max number of files on directory

Is there a limit of number of files in a directory?
I don??t talk about open files.
When i execute ll and ftp over a directory whit 5000 files, these don??t work.
I have hp-ux 11i

Thanks
5 REPLIES 5
Chris Vail
Honored Contributor

Re: Max number of files on directory

Whoa! 5000 files in one directory is too many. Its not a hard limitation, but one of speed and convenience. We had one application that inadvertently created more than a million files in a directory. We could NOT list the directory to see. What this does do is fill up the INODE table to the point that a single read takes so many clock cycles that it is virtually unreadable.

A practical limit is 256 (2^8), but you could probably have 1024 (2^10) without much trouble. Anything much more than that and then accessing that directory will take forever. Remember that a directory is just a flat file, containing information about other files. Accessing that flat file is not very efficient.

Interestingly, we could not rm * that directory. It would give "too many arguments". However, we could "for FILE in `ls -1';do;echo $FILE;rm $FILE;done". This ran for almost 3 full days to delete that many files--on an N class machine w/8 processors.

I'm not surprised ftp burped. Reduce the number of files in the directory and try again. Just FYI, you can probably still move the files around, just not list the directory.

Chris
Jose Mosquera
Honored Contributor
Solution

Re: Max number of files on directory

James A. Donovan
Honored Contributor

Re: Max number of files on directory

Yeah, the problem isn't that vxfs has a limit on the number of files, it's that those utilities (ll/ftp/rm) can only hold so much information in their buffers. Too many files and you'll see those errors like "too many arguments"
Remember, wherever you go, there you are...
TwoProc
Honored Contributor

Re: Max number of files on directory

try messing around with "xargs" to get a longer list into a function like "ls", or "rm". I've not used it myself, but I've seen people use it for this very purpose, but it's been so long since I've seen it I've forgotten how exactly it was used.
We are the people our parents warned us about --Jimmy Buffett
Jimmy_13
Advisor

Re: Max number of files on directory

Thanks for the help, i will move the files in some different directories.