Confused about spaces in path

What is the problem you are having with rclone?

I can't figure out how to handle spaces in paths.

What is your rclone version (output from rclone version)

rclone v1.55.1
- os/type: linux
- os/arch: amd64
- go/version: go1.16.3
- go/linking: static
- go/tags: none```

#### Which OS you are using and how many bits (eg Windows 7, 64 bit)
CentOS 7.8 (bash 4.2.46)

####  Which cloud storage system are you using? (eg Google Drive)
Dropbox


#### The command you were trying to run (eg `rclone copy /tmp remote:tmp`)  

rclone lsd dropbox:Team folder
rclone lsd dropbox:"Team folder"
rclone lsd dropbox:'Team folder'
rclone lsd "dropbox:Team folder"
rclone lsd 'dropbox:Team folder'
rclone lsd "dropbox:'Team folder'"
rclone lsd 'dropbox:"Team folder"'
rclone lsd dropbox:Team\ folder
rclone lsd dropbox:"Team\ folder"
rclone lsd dropbox:'Team\ folder'
target_dir="Team folder"
rclone lsd dropbox:$target_dir
rclone lsd dropobx:"$target_dir"



#### The rclone config contents with secrets removed.  

[dropbox]

type = dropbox

token = {"access_token":"","token_type":"bearer","refresh_token":"","expiry":""}


#### A log from the command with the `-vv` flag  

DEBUG : rclone: Version "v1.55.1" starting with parameters ["/usr/local/bin/rclone" "lsd" "dropbox:Team" "folder" "-vv"]
... usage hints ...
Command lsd needs 1 arguments maximum: you provided 2 non flag arguments: ["dropbox:Team" "folder"]


I got essentially the same error message from all of the permutations above.
The change log suggests that spaces can be used in remote paths, although the documentation ducks the question about how to do this under Linux. This may be shell-dependent, but at least one example would help clarify this.

Note: I have no problem using rclone commands on directories with no spaces in their paths, and in some cases I can rename directories to get around the problem. But not always.

What am I missing?

hello and welcome to the forum,

single quotes should work

rclone lsd 'dropbox:Team folder'

can you copy and paste the command in addition to the debug log.

Figured it out as soon as I posted.

My rclone was actually a transparent wrapper around an rclone singularity image.
That is, the wrapper script passes all of its parameters into the containerised rclone.
But the parameter passing is handled by bash, which splits up the arguments before rclone gets to have a look at it.

If I enter into the container and run rclone from there it works fine.

And thanks for the quick reply!

I've also encountered difficulty with spaces in a path.
I've observed the behavior can be different, between different versions of Bash shell, and/or Linux and macOS.
My Synology Linux DSM 6.2.4 has Bash version 4.3.48(1)
My macOS 10.14.5 has Bash version 3.2.57(1)
Using rclone version 1.55.1

It seems that literal quotes need to be passed to rclone, in the path parameter, so you may have to quote the quotes around the path, surrounding a single quoted path with double quotes. e.g.
"'rmt:folder/all my flowers'"
Single quotes, rather than double quotes, must surround the inner path
The double quotes may not always be needed. It might vary on the type of command you're running. e.g. ls vs. copy, and you might need to preceed the entire command with 'eval' e.g.

eval rclone copyto daisies.txt "'rmt:folder/my favorite flowers'"

If you don't have spaces in the path, then you don't have to go through such syntactic contortions. e.g.

rclone copyto daisies.txt rmt:folder/my_favorite_flowers

I'm not really sure of any of this, but perhaps I can comment more later, when I get a better sense of what's going on.

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