Filtering folders with spaces

I am having issues excluding folders with spaces. I am using Windows and copying to/from Google Drive. My command is:

"C:\Program Files (x86)\rclone-v1.51.0-windows-386\rclone" copy GD:\ "C:\Users\XXXX\Google Drive" --dry-run --exclude Backups --exclude "Google Photos"

In searching and looking at examples I tried various options but none worked. It is unclear to me if syntax changes depending on source/dest (I believe it does with regard to backslash/forward slash) and how spaces are handled. I tried "\Google Photos*", "/Google Photos/**", "\Google Photos*", "Google Photos*", "\Google Photos" etc.

Thanks

it depends, is the folder in the root of GD: or a subfolder

if the folder is in the root folder only
--exclude="/Google Photos/**"

to exclude from every folder and subfolder
--exclude="Google Photos/**"

1 Like

It is in the root. I believe it is a built in folder from Google Photos.

When I tried the first one I got:

"Command copy needs 2 arguments maximum: you provided 3 non flag arguments: ["GD:\" "C:\Users\XXXX\Google Drive" --dry-run --exclude Backups --exclude=/Google" "Photos/**"]"

It is obviously splitting the "Google" and "Photos" but I don't know why since it is in quotes.

what was the exact command you typed?
seems you are missing a quote at the start of the --exclude=

An aside.. you know that folder is no longer linked to Google photos anymore. Just fyi.

Yes, I remember they broke that off.

"C:\Program Files (x86)\rclone-v1.51.0-windows-386\rclone" copy GD:\ "C:\Users\XXXX\Google Drive" --dry-run --exclude Backups --exclude="/Google Photos/**"

The command works if I omit the last exclude.

Edit: I'll add that in my other use of Rclone I use only forward slashes. For example:

"C:\Program Files (x86)\rclone-v1.51.0-windows-386\rclone" copy GD:\Word c:\data\Word

works for me.

rclone.exe ls GD: 
        0 Google Photos/file.txt
        0 dummy/file.txt

rclone.exe ls c:\folder\ 

rclone.exe copy GD: c:\folder\ --exclude="/Google Photos/**" 

rclone.exe ls c:\folder\ 
        0 dummy/file.txt

When I use:

"C:\Program Files (x86)\rclone-v1.51.0-windows-386\rclone" copy GD:\ "C:\scrap\GD" --dry-run --exclude Backups --exclude="/Google Photos/**"

It works. I guess it doesn't like something about "C:\Users\XXXX\Google Drive". Figured it out....it is the \ at the end of "C:\Users\XXXX\Google Drive". It didn't like that for whatever reason.

when you post your commands and output, you should to use backticks or
image

if you had i would have noticed that \" is a problem for windows.
so either leave out that last slash or use two slashes.

this is a well known issue on windows
https://ss64.com/nt/syntax-esc.html
"To save a directory path with a trailing backslash () requires adding a second backslash to 'escape the escape'
so for example instead of "C:\My Docs\" use "C:\My Docs\\"

but as rclone commands normally use folders, that last \ is not needed.

rclone ls "c:\folder\" 
2020/05/22 19:33:13 ERROR : : error listing: directory not found
2020/05/22 19:33:13 Failed to ls with 2 errors: last error was: directory not found

rclone ls "c:\folder" 
        0 dummy/file.txt

rclone ls "c:\folder\\" 
        0 dummy/file.txt

Okay. Thanks for the help.

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