Failed on reading the "System Volume Information" folder even when excluding it

Hi there,
I encountered a weird thing (bug?) that rclone attempts to access the system volume information folder when copying from the root of a local drive to another one.
I did try to exclude the folder using the --exclude "System Volume Information/**" flag, but it does not work when a --include flag exists.

That is, for example
rclone copy C:/ D:/ -v --dry-run --exclude "System Volume Information/**" excludes the unwanted system volume information folder.
rclone copy C:/ D:/ -v --dry-run {--include Some-Wanted-Files} {--exclude All-Other-Files} --exclude "System Volume Information/**" does not work, where the curly braces {} means a series of include or exclude flags.
It generates an error like this:
System Volume Information: error reading destination directory: failed to open directory "System Volume Information": open \\?\D:\System Volume Information: Access is denied.

Note that the error message suggests that rclone tries to access the system volume information folder on the destination drive (D:\ in the above example), rather than the one of the source drive.
So it will not happen when copying a local drive from the root to a remote, but I don’t know if it will happen the other way around.

Is this the expected behavior or a bug?

rclone --version
rclone v1.38
- os/arch: windows/amd64
- go version: go1.9

rclone doesn’t parse a series of --include and --exclude flags correctly due to the flag parsing library it uses. I suggest you covert them all to --filter and then hopefully it will work correctly.

If you’ve got loads them putting them into a file and using --filter-from might be easier too.

Well actually I found the problem with the --filter in the first place, but choose to use --include and --exclude in the example because I thought they were the same and are more readable.

My goal is to let rclone copy only some of the files and folders while ignoring all the others, with the following example command:
rclone copy C:/ D:/ --dry-run --filter "+ FILE_NAME" --filter "+ FOLDER_NAME/**" --filter "- **"

There will be an error message about rclone cannot access the system volume information folder on the destination drive.
Furthermore, as described earlier, explicitly excluding the system volume information folder using --filter "- System Volume Information/**" does not work either.

BTW, I just tried the command without the --dry-run argument to see if this is a dry-run only problem.
However, in addition to the access denied error, rclone reports a new error:
FILE_NAME: Failed to copy: mkdir \\?: The filename, directory name, or volume label syntax is incorrect.

In fact, I just found that this error will be triggered when copy from a folder on a local drive to a destination path that matches one of the two conditions:

  1. It points to the root of a drive, such as D:/
  2. It points to a non-existing folder, such as D:/to_be_created

I think the problem with that command is that --filter "+ FILE_NAME" means look for a file called FILE_NAME in any folder so rclone can’t narrow down the folders it has to search. Perhaps this will do what you want? --filter "+ FOLDER_NAME/**/FILE_NAME" --filter "+ FOLDER_NAME/FILE_NAME"

This works for me when I try it

rclone.exe ls C:\ --filter "- Recovery/**" --filter "- System Volume Information/**" --filter "- PerfLogs/**" --filter "- $Recycle.Bin" --filter "- Config.Msi/**" --filter "+ VERSION" --filter "+ Go/**" --filter "- **"

Can you try instead of doing a copy do an ls with the filters - you should be able to get it to work.

That is a known issue: for which I’m awaiting a fix in the go standard library.


Ah! I did not notice that such pattern would match all files with the same name in all the directories.
Thanks a lot for your help!
Everything works as expected.

Great - I’m glad it is all working now :slight_smile: