Skip to content

--min-size and --filter-from do not work with copyto #2425

Open

Description

@cjnaz

What is the problem you are having with rclone?

Both switches are listed on the copyto doc page, but result in a Can't limit to single files when using filters error. The copyto doc does say This doesn’t transfer unchanged files, testing by size and modification time or MD5SUM. The doc inconsistency or code bug may apply to other similar commands.
For rclonesync, I'm working on a filtering solution for Google Doc files, and inadvertently ran into this error. file1.txt is a zero-length files that I do want to be copied with --min-size 0.

$ /bin/rclone copyto GDrive:/Exchange/file1.txt /path/file1.txt --filter-from /path/Filters --verbose
2018/07/29 11:57:51 Can't limit to single files when using filters: GDrive:/Exchange/file1.txt
$ /bin/rclone copyto GDrive:/Exchange/file1.txt /path/file1.txt  --verbose --min-size 0
2018/07/29 11:59:27 Can't limit to single files when using filters: GDrive:/Exchange/file1.txt
$ /bin/rclone copyto GDrive:/Exchange/file1.txt /path/file1.txt  --verbose
2018/07/29 11:59:42 INFO  : file1.txt: Copied (new)
2018/07/29 11:59:42 INFO  : 
Transferred:      0 Bytes (0 Bytes/s)
Errors:                 0
Checks:                 0
Transferred:            1
Elapsed time:          2s

My Filters file contains:

# Dropbox wont sync some files, so filtered here.  See https://www.dropbox.com/en/help/syncing-uploads/files-not-syncing
- .dropbox.attr
- ~*.tmp
- ~$*
- .~*
- desktop.ini
- .dropbox

# Used for rclonesync testing, so excluded from normal runs
- /testdir/**

What is your rclone version (eg output from rclone -V)

$ /bin/rclone -V
rclone v1.42

  • os/arch: linux/amd64
  • go version: go1.10.1

Which OS you are using and how many bits (eg Windows 7, 64 bit)

Centos 7, 64-bit

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 copyto

A log from the command with the -vv flag (eg output from rclone -vv copy /tmp remote:tmp)

above

Activity

  1. ncw commented on Jul 31, 2018

    @ncw
    Member

    I can fix it so that rclone copyto file1 file2 works.

    Would you expect that to obey the filters too? So if you put --min-size 0 then it wouldn't copy a zero sized file?

    I guess I can do that too.

  2. added this to the v1.43 milestone on Jul 31, 2018
  3. cjnaz commented on Jul 31, 2018

    @cjnaz
    ContributorAuthor

    Per the doc, copyto and moveto support single file or directory copies/moves. Having filtering honored (--include/--exclude/--filter, including -from versions) in the directory case make sense. Is the error message in the OP only in the case of requesting to copy a single file, when the filter also excludes it? I think that If the directory copyto case accepts the filter then the single file case could/should work the same, without an error. As is, script code using rclone would need to handle the case where the file being copied may conflict with the filter. Messy. Having filtering work the same for copy/copyto/move/moveto as with sync seems to be clean. You certainly have the bigger picture for what other problems this may cause.

    For --min-size, I was experimenting for how to filter Google Docs from my copies. --include/--exclude/--filter wouldn't do it since name filtering can't detect a Google Doc. I was trying to use --min-size, which is also not accepted on copyto/moveto, and perhaps other commands. For rclonesync.py, I currently have a --min-size 0 jammed in there to prevent errors if the Path1 is a Drive and there are Google Docs on the drive.

    I was experimenting with rclone lsl --min-size , and I think this works correctly as is. The size value is inclusive. --min-size 0b does list zero length files and not Google docs. Don't change this. :> --min-size and --max-size should be inclusive.

    Bottom line: Allow/support all sorts of filtering on single file copyto/moveto commands, and perhaps others you would be aware of in this context.

  4. ncw commented on Aug 1, 2018

    @ncw
    Member

    Is the error message in the OP only in the case of requesting to copy a single file, when the filter also excludes it?

    The way that the single file stuff works is that it puts in a list of files with a single file in that rclone will use and this is incompatible with adding other filters.

    Though this could be fixed now I come to think about it.

    I was experimenting for how to filter Google Docs from my copies

    BTW you can filter google docs out with --drive-skip-gdocs...

    Bottom line: Allow/support all sorts of filtering on single file copyto/moveto commands, and perhaps others you would be aware of in this context.

    OK!

  5. modified the milestones: v1.43, Soon on Sep 2, 2018
  6. daed-alus commented on Feb 17, 2023

    @daed-alus

    is this worked on? its very annoying to not be able to use filters with the copyto command

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions