Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows command line arguments - problems with " and \ #464

Closed
left1000 opened this issue Apr 30, 2016 · 8 comments
Closed

Windows command line arguments - problems with " and \ #464

left1000 opened this issue Apr 30, 2016 · 8 comments

Comments

@left1000
Copy link

left1000 commented Apr 30, 2016

rclone copy -v --log-file=logfile.txt "F:" "remote:Windows Fat"

http://pastebin.com/MQzkR18y

doesn't work at all, error makes no sense and for some reason rclone creates new folders inside it's own folder named Fat and Fat_

yet somehow
rclone copy -v --log-file=logfile.txt "F:\4" "remote:Windows Fat\4"
worked perfectly! but... ideally I'd like to backup this entire drive all at once and I have no idea why I can't

I very clumsily moved every single file from the F drive into a subfolder of F:\ called F and then the transfer copy command worked

I tried this in 1.27 and 1.29

oh in case it wasn't clear "Fat" is what I named the drive because it's in fat32 because I used it a long time ago. I'm not sure if that matters.

@ncw
Copy link
Member

ncw commented Apr 30, 2016

After a quick look this does look like a bug. Rclone is treating "remote:Windows Fat" as a local directory rather than a remote. Will investigate further!

@left1000
Copy link
Author

is it because I started with a root drive? or because of fat32? or windows keyword? either way it's baffling how simple the workaround is...

@ncw
Copy link
Member

ncw commented Apr 30, 2016

I'm away from my computer at the moment - I'll check the source when I get back and all will become clear!

@klauspost
Copy link
Collaborator

Use F:\ (no quotes).

However, there is something weird in the args parsing. "f:\" is not the same as f:\. Something is doing some escape-stuff. Windows explicitly claims not to do escape processing on \, so it may be some quirk with the flag parser.

@ncw
Copy link
Member

ncw commented May 2, 2016

I think you must have written this originally

rclone copy -v --log-file=logfile.txt "F:\" "remote:Windows Fat"

In the pastebin the first line is

2016/04/29 20:35:26 Local file system at : Replacing invalid characters in "\" remote:Windows" to "F:_ remote_Windows"

indicating that Windows thought rclone was being run with two arguments

  • F:\" remote:Windows
  • Fat

So I think this is caused by oddities in the windows command line parser as Klaus suggested, so

rclone copy -v --log-file=logfile.txt F:\ "remote:Windows Fat"

Should fix it

This is caused ultimately by CommandLineToArgvW which states:

CommandLineToArgvW has a special interpretation of backslash characters when they are followed by a quotation mark character ("), as follows:

  • 2n backslashes followed by a quotation mark produce n backslashes followed by a quotation mark.
  • (2n) + 1 backslashes followed by a quotation mark again produce n backslashes followed by a quotation mark.
  • n backslashes not followed by a quotation mark simply produce n backslashes.

The original command line had a mis-matched quote " so it would have been nice if it had given an error.

@ncw ncw changed the title I'm sorry this is a basic question but what am I doing wrong here? Windows command line arguments - problems with " and \ May 2, 2016
@left1000
Copy link
Author

left1000 commented May 6, 2016

thanks guys, that answers that, sorry for such a silly question! I'll remember this for the future.

@ncw
Copy link
Member

ncw commented May 6, 2016

@left1000 I don't think this is a silly question at all - it exposes a bit of windows oddness. I should probably put this either in the docs somewhere!

@ncw ncw mentioned this issue May 6, 2016
@ncw
Copy link
Member

ncw commented May 6, 2016

I've made another issue to write some more docs on the windows shell here #473

I'll close this ticket now as I think we've got to the bottom of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants