Future proofing the already created internal links to files and folders

My current installation type is a normal web app in Linux Server.

We are heavily using Nextcloud to produce internal links that we would like to consider as permanent because we are saving the links in our ERP in relation to Purchase Orders, Sales Orders e.t.c. This means that it will be near impossible to change the links in the ERP and that we need to keep them working in any change we do in the Nextcloud instance.

We would like to move the existing nextcloud server to another server and move away from the web app installation and use docker.

At the same time we will rearrange our folder structure where the files are stores.

Our main issue is how to move installation and keep the same links that we have created until now.

We will knwo exactly which file went where in the new structure. We need to keep the link the same.

Any ideas?

Please follow the official Migrating to a different server — Nextcloud latest Administration Manual latest documentation. Docker might have some specialties but in general all migrations follow same patterns…

1 Like

What about the matter of keeping the same links for the files already shared and at the same time restructure the folder structure, meaning that files will be moved around. I will not move the files from within nextcloud but from the OS level. How can i resassign the same sharing link for the same file ?

the goal of server_migration is to move an existing system to new “hardware” including files, shares and user database… please spend a second yourself

I understand that maybe my main concern is not reflected in my post title and content and i am really surprised how many times i stambled upon a post of your directing users to the same link. So i created another post that i clearly state my need. Sorry for being one more user :slight_smile:


I am aiming at having thousands of files that each one has an internal link.

This internal link will be embedded in an ERP where is almost impossible to change after it is embedded.

I need to make sure that i will be able to maintain the share link for the same files whatever the changes int he future.

I want to have a clear roadmap how to do this before i propose to go with Nextcloud.

Any ideas on that?

I merged new post into this thread to keep the forum clean. the reason why I keep posting this link is because it the right procedure and because most of the users don’t find it (due to various reasons).

and again the procedure address your issue - if you hit problems while migration please post the exact problem, log files and steps to reproduce.

1 Like

Lets say i migrate successfully my existing installation to another server/docket whaatever.

Then i move files around and recreate directories from Operating system Level, NOT from within Nextcloud interface. I did not find anywhere instructions how to update nextcloud to use the same links for the files i moved.

I’m sorry are you kidding? did you read the article?

No iam not kidding, and maybe i do not understand.

My case has nothing to do with migration.

  1. I have a working Nextcloud installation
  2. I create a share link for a file with name file1 residing in /folder1/folder2
  3. I use that link somewhere (ERP e.t.c)
  4. I MOVE the file from /folder1/folder2 to /folder35/folder36 and i do this from linux command lione or other tool external to nextcloud.

Obviously after step #4 the link doesnt work. What i need is to point the same link the the same file located now elsewhere. I have all the tracing where the file was and where it goes but i need to do the actual update in Nextcloud.

Is that what you understood i need? If not then probably i did not explain it well enough.

why do you do that? it would be way easier to have the same directories structure on your new server - at least that’s what I understand from the manual.

This is more a matter of future bulletproofing than anything. Of course i wil lkeep the structure the same as much as i can. But situation changes.

I just want to make sire that i will be able to keep the same link for hte same file regardless of its location.

ok, now I get the problem. It has nothing to do with server migration.

In general you should not do this :wink:

if you have to move files around for whatever reason I would still recommend to use built-in interfaces e.g. WebDAV - moving a file around doesn’t change it’s ID and preserves existing shares (so you don’t face the problem at all). If you really really have to go the disruptive way you can use cfg_share_links app to create new share using known URL token… if you want to automate it or create/adopt the share on large scale you can access the API https://docs.nextcloud.com/server/latest/developer_manual/client_apis/OCS/ocs-share-api.html

You might want to check Script `nc-shares` - list shares on command line and GitHub - nextcloud/sharelisting to list existing shares.

Spot on! Thanks… Now i have ways to make a proof of concept for what i need.

When you say to use built in interfaces WebDAV, you mean to just move around files from within Nextcloud UI?

Right now i have the nextcloud files in local disk. Lets say i need to move them to Hetzner Storage Boxes or NAS internal to the company.

you can only provide shares for internal Nextcloud files. as long you integrate NAS or Hetzner Storage Box or something else (as e.g. external storage) you can still use and move the file “internally” to such external storage… As long the file remains under control of the application Nextcloud keeps track of all attributes like permissions shares, tags etc… Once you mangle with the file (change the storage from outside) the file becomes “new” and all tied attributes are lost so you have to start from the beginning. moving the files outside of Nextcloud creates lot of issues (starting with the fact NC database contains staled data and you must run occ files:scan)… followed by the shares problem. I strongly recommend against such approach.

i will take your advice.

So i suppose i should head over the api documentation. If i need to just move files from local storage to external storage, shoudl i use the WEBDAV api or i am safe by doing it from within Nextcloud UI?


I would expect every “official” interface to create same results… there should be no difference in WebDAV, Web UI and client operations. I suggested WebAPI as I had the feeling you don’t want to use the UI for some reason.

I see. The only hesitation to move files fromt he UI has to do with possible timeouts etc, not something specifically against the UI.

So i think that i will split up my proof of concept in:

  1. Move the existing web app installation to docker (i suppose there is not something against using docker with nextcloud).
  2. Make sure that docker install works ok.
  3. Create links and test the process of moving them around to see what i get.

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.