Files:scan --path=xxx sometimes could not find directorys

Nextcloud version: 17
Operating system and version: Shared hoster
PHP version: 7.1

Seems strange, that files:scan seems not able to detect some paths but is able to detect a directory deeper.
User rights and groups are not different.

spwilch@marissa /Nextcloud> php occ files:scan --path=User9
The current PHP memory limit is below the recommended value of 512MB.
Path not found: /User9
+---------+-------+--------------+
| Folders | Files | Elapsed time |
+---------+-------+--------------+
| 0       | 0     | 00:00:00     |
+---------+-------+--------------+
spwilch@marissa /Nextcloud> php occ files:scan --path=User9/documents
The current PHP memory limit is below the recommended value of 512MB.
Starting scan for user 1 out of 1 (User9)
+---------+-------+--------------+
| Folders | Files | Elapsed time |
+---------+-------+--------------+
| 1       | 9     | 00:00:00     |
+---------+-------+--------------+
spwilch@marissa /Nextcloud> php occ files:scan --path=User9/files
The current PHP memory limit is below the recommended value of 512MB.
Starting scan for user 1 out of 1 (User9)
Path not found: /User9/files
+---------+-------+--------------+
| Folders | Files | Elapsed time |
+---------+-------+--------------+
| 139     | 941   | 00:00:03     |
+---------+-------+--------------+
spwilch@marissa /Nextcloud> php occ files:scan --path=User9/files/test
The current PHP memory limit is below the recommended value of 512MB.
Starting scan for user 1 out of 1 (User9)
+---------+-------+--------------+
| Folders | Files | Elapsed time |
+---------+-------+--------------+
| 2       | 8     | 00:00:00     |
+---------+-------+--------------+

First of all a directoy path should usually start with a leading slash, like e.g. “–path=”/alice/files/Music".
Second, if you use the --path option, the top-level “directory” usually indicates the name of the user, which in your case is “User9”. This isn’t a valid directory information for the file scan, because the user data root also contains other information, like cache, contacts, uploads etc. Valid files can only be found in the path “/files” and below. So it is understandable that you’re running into an error if you’ve give an invalid path :wink:

As you could see

-path=User9/files/test

is working, also

--path=User9/documents

does.

I learned that a directory without a trailing / means to start from where you are, but a trailing slash means every time to start in root.

In this case I do not see any difference if I add a / or if I don’t.

It might be possible that it works as soon as you add an additional directory, but as I wrote “User9” is not valid because usually NO files or directories should be places outside the files directory (//files) because this is usually the root of the user file system.