Powershell munges the colon in account:container

Hello all,

On Windows, this command works under the DOS CMD interpreter, but not under powershell …

rclone.exe --config config.conf sync account:container c:\users\moi\downloads

.\rclone.exe --config .\config.conf sync account:container c:\users\moi\downloads

Apparently the colon “:” is used to associate variables with a specific scope or namespace in powershell.

Have tried escaping, quotating, and the like but no luck.

Has anyone been able to work around this situation?

I’m sure I’ve tried that in powershell before… (don’t have access to a windows machine to try right now).

What error message did it give?

Are you trying to use variables? Eg $account:$container if so then if you specify them like this ${account}:${container} I think it will work.

If the dos command works as shown, you only need to ensure a string is passed, use single quotes:

PS C:\> rclone.exe lsf 'b2:my-bucket' --max-depth 1 --config 'C:\Users\MyName\.config\rclone\rclone.conf'

@ncw and @ritmo2k

So appreciate the timely response.

I think it may be cockpit error on my part because I have some other access issue on 443 and I am misinterpreting what it is telling me.

The reason I think this is because each of your solutions works in other environments, as does the simple account:container.

Unfortunately I can not yet explain what I am seeing so I think I have to conclude I am mistaken and therefore the question I asked is the wrong question and the issue is related to a specific environment.

Thanks, and if I figure out what is going on, I will report back.

1 Like

@ritmo2k and @moclouds well it seems maybe im getting the same issue here.

this command in cmd works fine
rclone.exe sync azure:gcdsmaster c:/gcdstest1 --progress --stats-one-line

in powershell though
.\rclone.exe sync 'azure:gcdsmaster' 'c:/gcdstest1' --progress --stats-one-line

throws me a nil pointer

.\rclone.exe : panic: runtime error: invalid memory address or nil pointer dereference

not sure why. possible a “go” dependency

Okay so that was message was because the path to azure had only folders and no files.

but now it runs. but doesnt display anything and closes

.\rclone.exe sync azure:gcdsmaster/2019/master c:/gcdstest1

Can you paste the traceback for that please? rclone shouldn’t ever do that!

Unless you use the -v flag rclone won’t print anything unless there are errors. The -P flag will show you what is going on (for progress) so that is better than -v for interactive use.

@ncw wtih respect to the nil pointer. It seems to happen if I try to sync a blob that only contains a folder in the first directory. (doesnt do this in cmd, only in powershell (v4.4) )

> ./rclone.exe : panic: runtime error: invalid memory address or nil pointer dereference
> At line:1 char:1
> + ./rclone.exe sync azure:gcdsmaster C:\gcdstest1 --progress
> + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>     + CategoryInfo          : NotSpecified: (panic: runtime ...ter dereference:String) [], RemoteException
>     + FullyQualifiedErrorId : NativeCommandError
> [signal 0xc0000005 code=0x0 addr=0x98 pc=0xddb71c
> ]
> goroutine 24 [running]:
> github.com/ncw/rclone/vendor/github.com/Azure/go-ansiterm.(*AnsiParser).csiDispatch
> (0xc0004f6340, 0xc000119540, 0xc000119540)
>     C:/gopath/src/github.com/ncw/rclone/vendor/github.com/Azure/go-ansiterm/parser_actions.go:72 +0x7ac
> github.com/ncw/rclone/vendor/github.com/Azure/go-ansiterm.csiParamState.Transition(0x122094a, 0x8, 0xc0004f6340, 
> 0x13aee80, 0xc000119540, 0x0, 0x0)
>     C:/gopath/src/github.com/ncw/rclone/vendor/github.com/Azure/go-ansiterm/csi_param_state.go:34 +0x1ee
> github.com/ncw/rclone/vendor/github.com/Azure/go-ansiterm.(*AnsiParser).changeState(0xc0004f6340, 0x13aee80
> , 
> 0xc000119540, 0xc000119540, 0x0)
> C:/gopath/src/github.com/ncw/rclone/vendor/github.com/Azure/go-ansiterm/parser.go
> :138 +0x33d
> github.com/ncw/rclone/vendor/github.com/Azure/go-ansiterm.(*AnsiParser).handle(0xc0004f6340, 0x4b, 0x0, 0x0)
>     C:/gopath/src/github.com/ncw/rclone/vendor/github.com/Azure/go-ansiterm/parser.go:120 +0x97
> github.com/ncw/rclone/vendor/github.com/Azure/go-ansiterm.(*AnsiParser).Parse
> (0xc0004f6340, 0xc0002ce600, 0xb7, 0xc0, 0xb7, 0xc0, 0x0)
>     C:/gopath/src/github.com/ncw/rclone/vendor/github.com/Azure/go-ansiterm/parser.go:99 +0x5f
> github.com/ncw/rclone/cmd.writeToTerminal
> (0xc0002ce3c0, 0xb7, 0xb9)
>     C:/gopath/src/github.com/ncw/rclone/cmd/progress_windows.go:33 +0x14b
> github.com/ncw/rclone/cmd.printProgress(
> 0x0
> , 0x0)
>     C:/gopath/src/github.com/ncw/rclone/cmd/progress.go:123 +0x38d
> github.com/ncw/rclone/cmd.startProgress.func2(0xc000168be0, 
> 0xc00006e3c0
> , 0x12863b0)
>     C:/gopath/src/github.com/ncw/rclone/cmd/progress.go:51 +0xa6
> created by 
> github.com/ncw/rclone/cmd.startProgress
>     C:/gopath/src/github.com/ncw/rclone/cmd/progress.go:41 +0xd6

@ncw with respect to the run and disappear thing. It disappears even though i specified -p. After specifying -v i do get an error message.

something about waiting for checks to finish. (once again only happens in powershell (v4.4) not cmd.

./rclone.exe : 2018/11/18 22:54:51 INFO  : Local file system at \\?\C:\gcdstest1: Waiting for checks to finish
At line:1 char:1
+ ./rclone.exe sync azure:gcdsmaster\2019\master C:\gcdstest1 -v
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (2018/11/18 22:5...hecks to finish:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
2018/11/18 22:54:51 INFO  : Local file system at \\?\C:\gcdstest1: Waiting for transfers to finish
2018/11/18 22:54:51 INFO  : Waiting for deletions to finish
2018/11/18 22:54:51 INFO  : 
Transferred:                0 / 0 Bytes, -, 0 Bytes/s, ETA -
Errors:                 0
Checks:                 0 / 0, -
Transferred:            0 / 0, -
Elapsed time:        1.3s

I’m not sure I understand what you mean? What does rclone lsf -R give on the source which causes the error?

Can you run the command with -vv --log-file rclone.log and paste the output of the log?


That isn’t an error message, that is just a log produced by the -v flag. Not sure why powershell thinks there is an error.

It looked like that sync was successful, but no objects were transferred. If the source has only empty directories in, that is what you’d expect as azure blob storage doesn’t have a concept of directory so rclone can’t store empty directories.

Is the case here that rclone writes to stderr, and PowerShell treats output from native commands on stderr as an error? You can work around this by tricking PowerShell into just outputting anything from stderr (and stdout) as strings:

rclone ...(your_arguments)... 2>&1 | %{ "$_" }

Yes rclone will write logs to stderr.

Ah ha!

You could also use the --log-file command.

This this

$bucket = "some_bucket"
$command = "E:\rclone\rclone.exe"
$arguments = "sync azure:$bucket\ C:\folder\"
$arguments = $arguments.Split(" ")
&"$command" $arguments
1 Like