Reputation: 356
i want to ask if there is a limit for how many files can be in a directory?
I write files with
File outputFile = new File("xy.txt");
outputFile.createNewFile();
and i got following Exception:
java.io.IOException: Input/output error
at java.base/java.io.UnixFileSystem.createFileExclusively(Native Method) ~[na:na]
at java.base/java.io.File.createNewFile(File.java:1043) ~[na:na]
...
The folder contains more than 1.7 million files, after clearing the folder the exception disapears.
When i create files manually (ssh to the host) I have no problems creating files.
Upvotes: 0
Views: 120
Reputation: 4034
The various operating systems and their flavours have all different limits for the number of files per folder/directory, and also for the number of files per file system and/or drive.
In addition, some operating systems or extensions to an operating system allow to impose a user quota for the number of files, again per directory/folder and/or per file system.
So the answer to your question is a clear yes.
For some operating systems/flavours, these numbers are configurable within some limitations (for file systems, usually a reformatting is necessary).
But as said, this is a limitation of the underlying OS, and nothing special for Java.
Upvotes: 1