Move ownership of a single folder to another user? Even the hard way?

I have a 37 GiB folder on my account that actually should belong to a different user. I just uploaded to my account and then shared it with them to ease them the trouble, probably about 2 years ago (in fact, I think I was using ownCloud at the time).

That folder is many times bigger than the rest of the stuff on my account combined, and since I’m using my account on a few devices, I always have to exclude this folder specifically in order to avoid taking up a ton of space on all my devices. So I’ve never really synced everything.

Now, I’d like to get rid of that folder from my own account, keeping it only on the other user’s account. In other words, I need to transfer the folder’s ownership.

I recognize that I could get the user to download everything and upload it again. I consider that the last option, because I’d rather not shift the problem unto the other user. But I realize that I can do that if all fails.

Reading answers from others, I’ve come across this: Using the occ Command — Nextcloud 12 Server Administration Manual 12 documentation

My problem with using files:transfer-ownership is that I don’t want to move the rest of my stuff, but only this single folder. I do not intend to disable or remove my user after having transferred the ownership - in fact it’s rather important that my user stays intact. :wink:

And so, the question is rather simple, but I’d like to split it into 2 parts.

  1. For admins and other users: Can I use some other occ function to move the ownership? For example, should files:scan be of any use here, and if so, how should it be used?

  2. For developers: I wonder why this feature isn’t already implemented. I’m tempted to jump all the way in and try to do this manually, by moving the files and altering the database (I’m a developer myself and have no problem with either PHP or SQL) but I’d rather not invest the time if there is some underlying design problem that prevents this from being easily implemented. This is just a bonus question; I won’t mind if no one feels comfortable addressing it. - But if it’s simply something that hasn’t been done yet, then maybe I might be able to contribute to implementing this feature in some way.

Thanks in advance and for a great product!

I’m guessing not, but did you get a reply/solution?

i suggest the following solution, but if this is important data be very careful and test it with some unimportant testfiles first.
important prereqs:
-you have shell-access
-user A: you; user B: other user who the files are transferred to

0. make sure you have a working backup of everything

  1. have user B create folder inside nextcloud; eg files-A
  2. log into the server as root and create hardlinks of all the files you want transferred to the directory that user B just ceated; eg
    ln $NC-DATA/data/user-A/files-to-be-transferred/* $NC-DATA/data/user-B/files-A/
    ($NC-DATA is your nextcloud-datadir; personally i’d use absolute paths in the ln-command)
  3. make your www-user owner of the newly created hardlinks (same perms and owner as in src-dir)
  4. run occ files scan:user B
  5. log into nextcloud as user B and check if the files are there and useable
  6. log into nextcloud as user A and delete one file; if after that it’s still there for user B (check it, but it must), delete the rest and/or the whole folder.

PLEASE create some test files to test this with first and do not do it if you do not have a working back-up.

GOOD LUCK!