Cannot transfer-ownership a folder includes spaces in his name

I am running the latest stable release of Nextcloud server.

I try to explain a bit how my setup is. And why :slight_smile:

I am running 3 servers.

  1. Nextcloud Server
  2. Webserver for website
  3. Windows 10 Pro
    ( Running several Powershell scripts on job scheduler. To get things remotely done on Webserver and Nextcloud server. Without user interaction. )

My issue is:

A user can create an folder for in this instance start a music collaboration. The user is free to choose a folder name. And for this time he likes the name New Music Collab as you can see this has spaces in it. The user submits the form.

The form is routed with email and as soon as it arrives at my mailserver. That form is been read out and a script is transferes this data into a file containing all variables in it for that created Collab.

A script is reading every 10 minutes in that folder for new files. If a new file is found it will copy a template folder and renaming it to the name the user submitted. Then it will be copied into a shared folder for all musicians with an folder structure like i made in the template. But this is done by a special created Admin user on Nextcloud.

Then I arrive at the issue. I readout beside the collab name also the Nextcloud user name and have put this also into a variable. To transfer-ownership to the correct user that created the Collab. Using plink i can start a ssh session to the Nextcloud server and login using a key so passwordless. So far so good. Then in this example the user created that folder with spaces in it. Using the following command in the remote session.

sudo -u www-data php /var/www/nextcloud/occ files:transfer-ownership --path New Music Collab BackendAdminNC UserCreatedCollab

Results in

Too many arguments to “files:transfer-ownership” command, expected arguments “source-user” “destination-user”

Using quotes on the folder results in

Unknown path provided: New Music Collab

I have readed somewhere that u not should use quotes in this. But i think because the spaces this is an issue with me here. What am I missing?
Got the feeling it is something small but I am overlooking this :slight_smile:

Hope someone can help out here?

occ files:transfer-ownership --path Neuer\ Ordner bob admin
Validating quota
Analysing files of bob ...
    0 [->--------------------------]
Collecting all share information for files and folders of bob ...
    0 [---------------->-----------]
Transferring files to admin/files/Übertragen von bob auf 2024-06-23 09-17-28 ...
Restoring shares ...
    0 [>---------------------------]

Works for me, but so does files:transfer-ownership --path "Neuer Ordner" bob admin. Which NC version are you using?

Nextcloud Hub 8 (29.0.2)
I get Unknown path provided:
Is there a fast way to check if the path existing for a specific user? Could it be that somehow the created folder is not indexed correctly in Nextcloud yet. Because it was created from windows. That would explain why the path is not been found. Just thinkin loud for myself :slight_smile:

I do see the folder when I login on de online portal of Nextcloud with that admin user.

Now it even gets more strange but it seems the issue is solved out of the blue,

I did a filescan and after it i just tried the same command again.


root@nextcloud-01:/home# sudo -u www-data php /var/www/nextcloud/occ files:transfer-ownership --path “Collabs/New Music Collab” BackendAdminNC UserCreatedCollab
Validating quota
Analysing files of ncadmin …
6 [============================]
Collecting all share information for files and folders of BackendAdminNC …
1 [============================]
Transferring files to UserCreatedCollab/files/transferred from ncadmin on 2024-06-24 05-50-19 …
Restoring shares …
0 [>---------------------------]

Anyone can explain this to me? So I know what the issue was? :slight_smile: