`rclone copy` disrespects `--include` filter and copies metadata of all source subdirectories

What is the problem you are having with rclone?

I am using rclone copy with the --include filter to copy a single file from a local source directory to a local backup drive.

After upgrading from rclone v1.65.2 to rclone v1.66.0, besides copying the specified file, rclone also creates all subfolders of the source directory including their metadata on the backup drive. This erroneous behavior is independent of using or not using the --metadata flag.

The expected behavior is that rclone only copies the specified file, just as it did in previous versions.

Should I open an issue on GitHub?

Run the command 'rclone version' and share the full output of the command.

rclone v1.66.0
- os/version: Microsoft Windows 11 Pro 23H2 (64 bit)
- os/kernel: 10.0.22631.3672 (x86_64)
- os/type: windows
- os/arch: amd64
- go/version: go1.22.1
- go/linking: static
- go/tags: cmount

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

None, local copy.

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

rclone copy "C:/Users/UserX/AppData/Roaming/AppY" "E:/Backup/AppY" --no-traverse --include "FileZ.txt" --config "" --log-level DEBUG

The rclone config contents with secrets removed.

None specified as local copy (--config "").

A log from the command with the -vv flag.

2024/06/11 11:33:42 DEBUG : rclone: Version "v1.66.0" starting with parameters ["C:\\Program Files\\WinGet\\Links\\rclone.exe" "copy" "C:/Users/UserX/AppData/Roaming/AppY" "E:/Backup/AppY" "--no-traverse" "--include" "FileZ.txt" "--config" "" "--log-level" "DEBUG"]
2024/06/11 11:33:42 DEBUG : Creating backend with remote "C:/Users/UserX/AppData/Roaming/AppY"
2024/06/11 11:33:42 DEBUG : Using config file from ""
2024/06/11 11:33:42 DEBUG : fs cache: renaming cache item "C:/Users/UserX/AppData/Roaming/AppY" to be canonical "//?/C:/Users/UserX/AppData/Roaming/AppY"
2024/06/11 11:33:42 DEBUG : Creating backend with remote "E:/Backup/AppY"
2024/06/11 11:33:42 DEBUG : fs cache: renaming cache item "E:/Backup/AppY" to be canonical "//?/E:/Backup/AppY"
2024/06/11 11:33:42 DEBUG : FileZ.txt: Need to transfer - File not found at Destination
2024/06/11 11:33:42 DEBUG : FileZ.txt: md5 = 44edc5da79b289f81094d8d5952efde7 OK
2024/06/11 11:33:42 DEBUG : snippets: Making directory with metadata
2024/06/11 11:33:42 DEBUG : FileZ.txt.yogujih4.partial: renamed to: FileZ.txt
2024/06/11 11:33:42 INFO  : FileZ.txt: Copied (new)
2024/06/11 11:33:42 INFO  : snippets: Made directory with metadata (mtime=2022-10-27T05:04:56.1277109-03:00)
2024/06/11 11:33:42 DEBUG : Added delayed dir = "snippets", newDst=snippets
2024/06/11 11:33:42 DEBUG : sync: Making directory with metadata
2024/06/11 11:33:42 INFO  : sync: Made directory with metadata (mtime=2024-06-11T08:43:33.2009856-03:00)
2024/06/11 11:33:42 DEBUG : Added delayed dir = "sync", newDst=sync
2024/06/11 11:33:42 DEBUG : sync/extensions: Making directory with metadata
2024/06/11 11:33:42 INFO  : sync/extensions: Made directory with metadata (mtime=2024-06-11T08:43:32.938924-03:00)
2024/06/11 11:33:42 DEBUG : Added delayed dir = "sync/extensions", newDst=sync/extensions
2024/06/11 11:33:42 DEBUG : sync/globalState: Making directory with metadata
2024/06/11 11:33:42 INFO  : sync/globalState: Made directory with metadata (mtime=2024-06-11T08:43:32.7882348-03:00)
2024/06/11 11:33:42 DEBUG : Added delayed dir = "sync/globalState", newDst=sync/globalState

[snip: excluding logging messages of creating a few hundred more directories for better readability]

2024/06/11 11:33:43 DEBUG : Local file system at //?/E:/Backup/AppY: Waiting for checks to finish
2024/06/11 11:33:43 DEBUG : Local file system at //?/E:/Backup/AppY: Waiting for transfers to finish

[snip: excluding logging messages of setting modification time of a few hundred directories for better readability]

2024/06/11 11:33:43 INFO  : sync/globalState: Set directory modification time (using SetModTime)
2024/06/11 11:33:43 INFO  : sync/extensions: Set directory modification time (using SetModTime)
2024/06/11 11:33:44 INFO  : sync: Set directory modification time (using SetModTime)
2024/06/11 11:33:44 INFO  : snippets: Set directory modification time (using SetModTime)
2024/06/11 11:33:44 INFO  :
Transferred:              9 B / 9 B, 100%, 8 B/s, ETA 0s
Transferred:            1 / 1, 100%
Elapsed time:         1.2s

2024/06/11 11:33:44 DEBUG : 5 go routines active

welcome to the forum,

Thanks for fast reply. Ok, I will continue to use v1.65.2 until the fix is out. :+1:t2: