File migration problem

I deployed a nextcloud. How can I migrate the existing files and folders to nextcloud?


Please consider adding few more details,

  1. How did you deploy NextCloud? In Some Cloud Server or in your local machine?
  2. Which method did you use? Docker, Native Installation, Snap or something else?
  3. Where are the existing files and folder stored and how big are they?
  4. How many users will there be in your NextCloud and what are the relation between those files and folder you wish to move and your users? Do they all should have access to all files or there are separate permissions?


The answers to your questions are as follows, thank you.

  1. nextcloud is deployed in the local machine.
  2. The docker deployment method used
  3. The existing files and folders are in the local disk, which is about 4T.
  4. Now there is only one administrator account, and new accounts will be added in the future. I hope they can all access these files.


Think about whether you really want to have all the data in the Nextcloud. What advantages do you expect?

Every user has got his/her own directory and files and the files can be share with other persons. But if you have got “global” files maybe you can better use External Storage (look in the document Local vs. SMB/CIFS).

If you want to migrate data to one user you can use a manually linux copy/move action an re-scan your Nextcloud. For details please post again.

I have copied a file in linux to the folder of admin account. How can I scan it again to see this file? Thank you.

First pay attention to set the correct user rights. Webserver user e.g. www-data.
Second your Nextcloud Database does not know the file. You must re-scan the files.
Read this.


I deployed nextcloud with docker, but after entering the container and running the command php occ files:scan --help, I returned the following:

Nextcloud is not installed - only a limited number of commands are available

There are no commands defined in the “files” namespace.

Does container deployment not support running occ naming?

Read this.


This last point makes things bit difficult.

NextCloud doesn’t work like Windows Drive or Linux folder sharing. It’s more like Google Drive type concept.

Every user is by default can only access their own files located within their own root directory only. Just like in Google Drive, one user needs to share a folder or file with other users to let them access that.

Now if all of those files are something that you want all future users to access without any restriction, then its simple, putting the entire 4TB within a folder of your admin nextcloud account and manually add share access to all new users as you add them in future.

However, things are complicated when you consider selective file or folder access.

For that first short the entire 4TB files accordingly and make separate folders before moving the data to nextcloud. So that in future you can add selective share permissions in different folder.

The existing files and folders are in the local disk, which is about 4T.

I have not used Docker, but I have used snap for my deployment. However the process should be simple for moving the files. For Linux (Ubuntu) cp -r /source/location /destination/location command should do the trick

For snap, the default location of NextCloud user data is → /var/snap/nextcloud/common/nextcloud/data There you may find separate directories for individual users. Docker will have a similar location I guess. Wait for others to reply or do a search.

Once nextcloud installed and you don’t have disc encryption enabled, moving any file / folder in that respective user folder would have nextcloud show that.

However, there is another stupid but simple method of doing it. Since the files are within your local machine, why not just open the NextCloud web page (via your local NAT IP) and simply upload the entire 4TB in your admin account? It will take same time as copying them. But its dead simple.


thank you . I have solved this problem.

Thank you for your answer. I have found the answer to this question with the help of others.