Skip to content

Cli syntax: Multiple sources for single destination #4308

Closed

Description

@darkdragon-001

What is your current rclone version (output from rclone version)?

rclone v1.50.2

What problem are you are trying to solve?

Use shell globbing (*) to copy multiple files.

How do you think rclone should be changed to solve that?

rclone copy should allow multiple source arguments and a single destination argument like rsync, mv, ...

Activity

  1. animosity022 commented on Jun 5, 2020

    @animosity022
    Contributor

    That already exists via the filtering as a directory is normally the source until you want to move a single file.

    Can you give an example of what you'd want to happen if I'm not understanding it?

  2. darkdragon-001 commented on Jun 6, 2020

    @darkdragon-001
    ContributorAuthor

    I want multiple directories or files

    rclone copy /folder/prefix* backend:bucket/path/
    

    Should copy folder/prefix and /folder/prefix_something, but fails with the message that only two non-flag arguments are allowed, but three given.

  3. animosity022 commented on Jun 6, 2020

    @animosity022
    Contributor

    You can already do that with include / filters.

    Example would be:

    felix@gemini:~/test$ rclone ls /home/felix/test
          413 prefixtest/hosts
          413 prefixblah/hosts
          413 nope/hosts
    felix@gemini:~/test$ rclone ls /home/felix/test --include 'prefix**'
          413 prefixtest/hosts
          413 prefixblah/hosts
    
  4. darkdragon-001 commented on Jun 6, 2020

    @darkdragon-001
    ContributorAuthor

    Thanks for your example of using include/filters!

    I am just saying that if you are claiming to be the rsync for cloud storage, I would expect to be as compatible as possible with rsync syntax. Otherwise people will use rclone/goofys only to mount the folder and continue using rsync which obviously has multiple downsides...

  5. animosity022 commented on Jun 6, 2020

    @animosity022
    Contributor

    I think that was an old line that was removed as it was confusing for me as well as rclone is not rsync and doesn't plan to be.

    The goal does not seem to be equivalent rsync commands. If you check the updated pages, please let us know if something seems. off still as rclone.org has been updated recently with changes to prevent those confusing things.

  6. darkdragon-001 commented on Jun 6, 2020

    @darkdragon-001
    ContributorAuthor

    Maybe a migration guide would be helpful then, which rsync commands/flags translate to which rclone ones...

  7. animosity022 commented on Jun 6, 2020

    @animosity022
    Contributor

    That feels like quite a rabbit hole to go down as rsync is very different from rclone in how it works and what it does imo.

    That doesn't feel maintainable to me as it's hard enough to keep just documentation clean and up to date.

    Perhaps @ncw and @calisro and @darthShadow can chime and share their feedback or something like that.

  8. darkdragon-001 commented on Jun 6, 2020

    @darkdragon-001
    ContributorAuthor

    When moving from traditional network shares (samba, nfs, ...) to cloud storage (S3, Minio, Backblaze), I was looking for a replacement of rsync to accomplish the same things (copy files and folders reliably and easily) in the cloud domain. The more I learn about rclone, the more complicated it becomes (you have seen the other issues I opened)... I just want to copy some files! Maybe rclone is not the right tool for this task...

  9. darkdragon-001 commented on Jun 6, 2020

    @darkdragon-001
    ContributorAuthor

    I am closing the issue since it seems to be intended behavior.

  10. ncw commented on Jun 8, 2020

    @ncw
    Member

    rclone copy should allow multiple source arguments and a single destination argument like rsync, mv, ...

    This would work nicely for local to remote copies. It wouldn't work at all for remote to local copies though as if the shell is interpreting the globs then it won't know how to interpret them for a remote

    rclone copy *.jpg drive: # could be made to work
    rclone copy drive:*.jpg . # won't work
    

    I could make the source files understand globbing so you'd write

    rclone copy "*.jpg" drive: # could be made to work
    rclone copy "drive:*.jpg" . # won't work
    

    And rclone would convert that to

    rclone copy . --include "*.jpg" drive:
    rclone copy drive: --include "*.jpg" .
    

    Multiple sources for copy would be relatively easy but all the source files would have to be limited to the same backend.... Maybe even limited to the local disk.

  11. darkdragon-001 commented on Jun 8, 2020

    @darkdragon-001
    ContributorAuthor

    This is why I named the issue "multiple sources" and not "shell globbing". So I think it would be perfectly fine to just allow multiple sources. For remote wildcards, one can use the --include filter. If it is limited to a single backend, this is also fine when a comprehensible error message is shown when different backends are specified...

  12. ncw commented on Jun 10, 2020

    @ncw
    Member

    What do you think about the multiple sources being limited to the local disk? Is that too limiting?

  13. reopened this on Jun 10, 2020
  14. 14 remaining items

  15. added this to the v1.54 milestone on Sep 5, 2020
  16. ivandeex commented on Nov 16, 2020

    @ivandeex
    Member

    From #1426 (comment)

    Currently rclone treats metacharacters (*?) in source file name as part of the name, while in source filter arguments (--include --exclude) they are treated as globs. Changing this behavior would break existing scripts.

    UPD: It's even more tricky. If rclone is run interactively on a Windows(powershell) or Unix(bash/*sh) command line but source argument is located on a remote, user must properly escape metachars to prevent shell globbing (and let rclone do the remote listing and globbing/filtering and apply many other filtering options). If source is local then shell globbing would be probably ok, but rclone would have to reparse command line (some verbs require more arguments than just source and destination).

    The only solution I can see is a new flag like --source-is-filter. The flag is probably meaningful for copy move sync delete commands, meaningless for copyto and many others. It needs more investigation, looks like a pretty large task.

    I tend to agree with @ncw, keep copy/move behavior as is and introduce unix-like cp/mv verbs.

  17. modified the milestones: v1.54, v1.55 on Feb 3, 2021
  18. modified the milestones: v1.55, Known Problem on Mar 31, 2021
  19. ivandeex commented on Mar 31, 2021

    @ivandeex
    Member

    @ncw @darkdragon-001

    We agree that using filters is not enough.
    This request will be implemented by the new cp, mv, rsync commands (tickets #4777 and #4776).

    All valid requirements have been copied over to #4777

    @darkdragon-001
    Please subscribe to the new ticket.
    As it is quite tricky to replicate the features of cp/mv we can't provide ETA yet.

  20. ivandeex commented on Mar 31, 2021

    @ivandeex
    Member

    I am going to close this as all requirements are collected in #4777

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