I have nearly 40,000 folders with over 187,000 files to add to a nextcloud server. I did quite a bit a research and finally find an answer which I give below. I added this here so others did not need to do the searching to find the solution.

1 Answer 1


I eventually found an explanation on help.nextcloud.com by fab. Here is a summary of the steps to use.

  • Working as root or using sudo.
  • Find where the nextcloud data is stored. You typically will find this in the /var/www/nextcloud/config/config.php. Search for datadirectory such as grep datadirectory /var/www/nextcloud/config/config.ph/config.php
  • Determine which sub-directory you want to place the data you are loading and load the data to that directory.
  • Change the ownership: chown www-data:www-data -R /<directory you loaded to>/
  • cd /var/www/nextcloud
  • Include the new directories and files into the nextcloud database with: sudo -u www-data php console.php files:scan --all

This may take some time. The 187,000 files on my system took 17 minutes to do the scan.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .