How to copy multiple directories with wildcards AND have the directories created on target

What is the problem you are having with rclone?

Hi. When I copy directories using wildcards, I get an error "directory not found", but I need to copy multiple directories that start with the same letter. I'm sure there must be a simple way of doing this, but I can't find it.

I have multiple directories with spaces in the names and starting with the same letter, e.g.:

remote:backup/data/dir a1
remote:backup/data/dir a2
remote:backup/data/dir b1

etc.

I need to copy all directories starting with "dir a*" and have the directories created on the target.

Thanks in advance!

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

rclone v1.53.0

  • os/arch: windows/amd64
  • go version: go1.15

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

Google Drive

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

rclone copy --bwlimit "8M" --progress "remote:backup/data/dir a*" "D:\data"

The rclone config contents with secrets removed.

[remote]
type = drive
client_id = [...].apps.googleusercontent.com
client_secret = [...]
scope = drive
token = {"access_token":"[...]","token_type":"Bearer","refresh_token":"[...]","expiry":"2023-08-07T14:56:07.2838511-05:00"}


A log from the command with the -vv flag

rclone copy --bwlimit "8M" --progress "remote:backup/data/dir a*" "D:\data" -vv
2023/08/07 14:02:33 DEBUG : rclone: Version "v1.53.0" starting with parameters ["rclone" "copy" "--bwlimit" "8M" "--progress" "remote:backup/data/dir a*" "D:\\data" "-vv"]
2023/08/07 14:02:33 DEBUG : Using config file from "C:\\Users\\Richard\\.config\\rclone\\rclone.conf"
2023/08/07 14:02:33 INFO  : Starting bandwidth limiter at 8MBytes/s
2023/08/07 14:02:33 DEBUG : Creating backend with remote "remote:backup/data/dir a*"
2023/08/07 14:02:34 DEBUG : Google drive root 'backup/data/dir a*': root_folder_id = "0AP_mEME7hkY8Uk9PVA" - save this in the config to speed up startup
2023/08/07 14:02:35 DEBUG : Creating backend with remote "D:\\data"
2023/08/07 14:02:35 DEBUG : fs cache: renaming cache item "D:\\data" to be canonical "//?/d:/data"
2023-08-07 14:02:35 ERROR : : error reading source directory: directory not found
2023-08-07 14:02:35 DEBUG : Local file system at //?/d:/data: Waiting for checks to finish
2023-08-07 14:02:35 DEBUG : Local file system at //?/d:/data: Waiting for transfers to finish
2023-08-07 14:02:35 INFO  : There was nothing to transfer
2023-08-07 14:02:35 ERROR : Attempt 1/3 failed with 1 errors and: directory not found
2023-08-07 14:02:35 ERROR : : error reading source directory: directory not found
2023-08-07 14:02:35 DEBUG : Local file system at //?/d:/data: Waiting for checks to finish
2023-08-07 14:02:35 DEBUG : Local file system at //?/d:/data: Waiting for transfers to finish
2023-08-07 14:02:35 INFO  : There was nothing to transfer
2023-08-07 14:02:35 ERROR : Attempt 2/3 failed with 1 errors and: directory not found
2023-08-07 14:02:36 ERROR : : error reading source directory: directory not found
2023-08-07 14:02:36 DEBUG : Local file system at //?/d:/data: Waiting for checks to finish
2023-08-07 14:02:36 DEBUG : Local file system at //?/d:/data: Waiting for transfers to finish
2023-08-07 14:02:36 INFO  : There was nothing to transfer
2023-08-07 14:02:36 ERROR : Attempt 3/3 failed with 1 errors and: directory not found
Transferred:             0 / 0 Bytes, -, 0 Bytes/s, ETA -
Errors:                 1 (retrying may help)
Elapsed time:         2.3s
2023/08/07 14:02:36 INFO  :
Transferred:             0 / 0 Bytes, -, 0 Bytes/s, ETA -
Errors:                 1 (retrying may help)
Elapsed time:         2.3s

2023/08/07 14:02:36 DEBUG : 4 go routines active
2023/08/07 14:02:36 Failed to copy: directory not found

Do not use wildcards in source name:) See details here.

In your case correct syntax using --include flag would be:

rclone copy remote:backup/data D:\data --include "/dir a*/**"

And update your rclone version - you are using real vintage one:)

Thanks so much for the quick reply!

I had come across --include but couldn't quite make sense of it for my situation - you cleared it up for me :slight_smile:

And I'll update my version.

Thanks so much!

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