Advices to import a large number of albums and photos vidéos


I have hundreds of albums and tens of thousands of photos and videos stored on a hard drive.

The structure of the albums is as follows:

  • 2023 (folder)
    – Country (sub-folder)
    — City (sub-folder of sub-folder)

  • 2022 (folder)
    – Country (sub-folder)
    — City (sub-folder of sub-folder)

  • etc.

I understand that it is not possible to import photos via FTP (as I did with Piwigo). I can’t Drag & Drop albums on the interface either.

Therefore, could you tell me how you would go about importing these albums?


I would connect the harddrive (e.g. with usb) and add it as external storrage

But that is only possible if you have local access to your server

Why not? Are you on Nextcloud 28? Drag & Drop feature is broken on Nextcloud 28. It will be fixed soon…

You could upload the complete file structure with sftp, then import them to your cloud with occ files:scan

You have much posibilities but you did not give enough information to give more special advice for your usecase.

Much luck,

Hello Ernolf,

I have a local access to my server as it is in my home. So it’s possible for me to to connect the harddrive with usb and add it as external storage.
I will try this solution but I would like to import the files of the hard drive into my Asustor server which I have just purchased for the occasion and which has the necessary space to host all the albums. To avoid duplication, I want to import albums directly into Nextcloud, rather than passing them through the Asustor application.

I am using the version 27.1.2.r01 of Nextcloud (downloaded in the Asustor App Central).

You could upload the complete file structure with sftp, then import them to your cloud with occ files:scan

I will read the documentation on this.


Thats nice!

You should normaly read the documentation first :wink:

So, then you can simply copy the files to the directory where you want to have your album with photos.


I assume the following circumstances:

  • Ubuntu operating system with web server user “www-data
  • Nextcloud server directory: “/var/www/nextcloud
  • Nextcloud data directory: “/nextcloud/data
  • Cloud user named “NextUzer
  • USB hard drive mounted on “/media/USB-Drive

then your cloudfiles are located in:

  • /nextcloud/data/NextUzer/files/

create a folder for your album e.g.:

sudo mkdir -p /nextcloud/data/NextUzer/files/PhotoAlbum

If you want to copy all the content from that drive into your newly created directory, simply run:

sudo cp -at /nextcloud/data/NextUzer/files/PhotoAlbum/ /media/USB-Drive/*

that can take some time, depending on the amount of data.

after everything is ready copied change the owner of the files:

sudo chown -R www-data.www-data /nextcloud/data/NextUzer/files

Now all your files are on the right location with the right owner and you only have to import them into the database with this command:

sudo -u www-data php -f /var/www/nextcloud/occ files:scan --generate-metadata --unscanned -- NextUzer

which can take some time.

After everything is scanned, you wil find all your photos in the same structure as on your harddrive inside of the cloud account of user “NextUzer” and you can umount and remove your usb harddrive.

Much luck,