Hi, I have noticed that there is a disparity between the number of files shown by Nextcloud and the number that actually exists on the file system, for example I’ve seen in Nextcloud that I have : 4042104 files, but in the file system with the command
find . -type f | wc -l show me only 1784011,
What could be the cause of this disparity?
Nextcloud version: 184.108.40.206
Operating system and version : CentOS Linux release 7.6.1810
Apache or nginx version : Apache/2.4.6
PHP version : 7.1.31
The issue you are facing:
I need to know with precision the number of files stored
Is this the first time you’ve seen this error? Y
Steps to replicate it:
- Login admin
- See the number of files
Are we talking only about files in Data Folder or whole NC installation with apps?
What’s about your files dustbin (of deleted Files)?
This question is difficult to answer without having a closer look on your system. Would it be possible that you break-down the number of files by e.g. counting the files in each sub-directory? BTW, you can e.g. use
-maxdepth 1 to restricted the count result to the current directory only.
In the Data Folder … “What’s about your files dustbin (of deleted Files)?” Interesting question … NC count these files in the value of "Number of Files?
More or less, I scan all the Data Folder with all user, including cache , files_version directories … so I would expect the number of files that command find show me will be more than NC, but it’s the opposite, for example in a smaller installation:
NC ==> 238472
find (in data folder) ==> 144940
Yes, that’s what I find surprising too. I don’t imagine that e.g. hard links could cause this discrepancy, especially because of the number of files which would be impacted.
The question is: How NC count the files, from the DB? It’s very strange, another test: I have created 2 new files and NC count 7 more files and find 5 more:
NC data ==> 238472 to 238479 +7
find data ==> 144940 to 144945 + 5
Are the files perhaps counted multiple times, like once for each user? Also in addition there may be previews.
As it hasn’t been answered, I am opening a new topic : Num_files value in system api?