Scan absolute path

hello

I need to scan an absolute path

instead of
sudo -u www-data php /var/www/html/nextcloud/occ files:scan --path=“user/files/other/”
use
sudo -u www-data php /var/www/html/nextcloud/occ files:scan --path="/var/www/data/user/files/other/"

Is this possible?

If you not have millions of files you can use:

sudo -u www-data php /var/www/html/nextcloud/occ files:scan --all

Also you can perhaps only scan one user:

sudo -u www-data php /var/www/html/nextcloud/occ files:scan user

I think Nextcloud knows the corresponding directorys. It make no sense to scan “random” directories like “other”. If they are not listed i think there is another problem. Can you explain your problem?

Thanks for your reply

I’m creating a file management web application that asks the user for the location where he wants to save the files he uploads. Logically, this is an absolute location. Additionally, the application creates subdirectories within that location depending on the type of file and the form from which it was uploaded.

My intention was to avoid having to ask for the relative location to scan.

files:scan --all would take a long time if there are many files

Yes. But perhaps you can only scan the user.

Maybe you can use WebDAV or a Nextcloud API. Then you do not need rescan. But i think you use the file management and Nextcloud on the same or two servers and you do not want really interact with the client.

Can you explain it? Is Nextcloud not a file management web application? :wink:

Oh, of course

The application is an ERP in which all kinds of documents are created and saved in pdf format, organized by type.

The application and nextcloud are on a server and the administrator indicates where (within nextcloud) the documents are saved. The nextcloud desktop application is installed on each workstation and, depending on the user, has access to certain data because the subdirectory is shared by the administrator and is synchronized with the server.

I will try to create the folder from the application and upload the file with WebDAV, although I am afraid that it will not work, since the subdirectory that contains it is not previously synchronized

Thank you. And yes you can test perhaps WebDAV.

How many users and files do you have?
Have you ever make performance tests with “occ files:scan” and different options?

Do you need the files from ERP direct or e.g. at the next day?
Then you can use “files:scan” with cron in the night.

Currently there are 10 users and each one has approximately 30G of data, independent of what is generated by the application that is not yet operational.

The application will reduce duplicate documents for each user and it is intended that they be available to everyone once created, which is why a scan is performed exclusively in the directory in which the file is created.

So far I have only scanned with the indicated option, what other options can I have?

Perhaps you can use or not use this options:

  --quiet               suppress any output
  --verbose             files and directories being processed are shown
                        additionally during scanning
  --unscanned           scan only previously unscanned files

documentation