Skip to content

Change moveto/copyto support moving a file to an existing directory #1175

Closed

Description

@eharris

Currently moveto/copyto do not support moving files to an existing directory. That is, it seems to provide only a "rename" capability rather than following conventional move/copy semantics that support moving (potentially multiple) items to a destination target directory. Essentially I think these should work:

rclone moveto file existingdir
rclone moveto file existingdir/

Currently these delete existingdir (if it is empty) and rename file to that name, or if existingdir is not empty, it fails with the following error:

ERROR : existingdir: Couldn't delete: remove /some/path/existingdir: device or resource busy

Activity

  1. added this to the v1.37 milestone on Feb 26, 2017
  2. ncw commented on Feb 26, 2017

    @ncw
    Member

    Currently these delete existingdir (if it is empty) and rename file to that name, or if existingdir is not empty, it fails with the following error:

    I've fixed that in 79e3c67

    The rest I'll do in 1.37

  3. modified the milestones: v1.37, v1.38 on Jul 19, 2017
  4. modified the milestones: v1.38, v1.39 on Sep 30, 2017
  5. modified the milestones: v1.39, Soon on Jan 11, 2018
  6. ivandeex commented on Feb 12, 2021

    @ivandeex
    Member

    Closing after 4 years of inactivity

  7. eharris commented on Feb 12, 2021

    @eharris
    ContributorAuthor

    It seems like this was accepted by @ncw, but hasn't been implemented/resolved yet. So why close?

  8. ivandeex commented on Feb 12, 2021

    @ivandeex
    Member

    @ncw What is status of this ticket? It was not updated since 2017. User says it was accepted. Do you still remember?

  9. ncw commented on Feb 12, 2021

    @ncw
    Member

    The problem still exists

    $ touch file
    $ mkdir existdingdir
    $ rclone moveto -vv file existdingdir
    2021/02/12 11:30:08 DEBUG : rclone: Version "v1.55.0-beta.5177.4d83a9899.add-scsu-tables" starting with parameters ["rclone" "moveto" "-vv" "file" "existdingdir"]
    2021/02/12 11:30:08 DEBUG : Creating backend with remote "file"
    2021/02/12 11:30:08 DEBUG : Using config file from "/home/ncw/.rclone.conf"
    2021/02/12 11:30:08 DEBUG : fs cache: adding new entry for parent of "file", "/tmp"
    2021/02/12 11:30:08 DEBUG : Creating backend with remote "."
    2021/02/12 11:30:08 DEBUG : fs cache: renaming cache item "." to be canonical "/tmp"
    2021/02/12 11:30:08 ERROR : Attempt 1/3 failed with 1 errors and: "existdingdir": is not a regular file
    2021/02/12 11:30:08 ERROR : Attempt 2/3 failed with 1 errors and: "existdingdir": is not a regular file
    2021/02/12 11:30:08 ERROR : Attempt 3/3 failed with 1 errors and: "existdingdir": is not a regular file
    2021/02/12 11:30:08 INFO  : 
    Transferred:   	         0 / 0 Bytes, -, 0 Bytes/s, ETA -
    Errors:                 1 (retrying may help)
    Elapsed time:         0.0s
    
    2021/02/12 11:30:08 DEBUG : 2 go routines active
    2021/02/12 11:30:08 Failed to moveto: "existdingdir": is not a regular file
    

    So the request is, if the destination in an rclone moveto command is an existing directory then move the file into that directory.

    I think what we are re-creating is the semantics of mv, so this issue should probably be merged with the rclone mv and rclone cp issue where we recreate exactly the semantics of those unix commands in rclone.

    That's #4777

  10. ivandeex commented on Feb 12, 2021

    @ivandeex
    Member

    @ncw ok
    @eharris see #4777 (comment) ok with you?

  11. removed this from the Soon milestone on Feb 12, 2021
  12. ivandeex commented on Feb 12, 2021

    @ivandeex
    Member

    Merged into #4777 (comment)

  13. eharris commented on Feb 12, 2021

    @eharris
    ContributorAuthor

    Making new commands for this that mirror unix semantics seems like a good idea if retaining the current behavior is needed. Although this ticket predates the other by quite a long time.

  14. ivandeex commented on Feb 13, 2021

    @ivandeex
    Member

    Making new commands for this that mirror unix semantics seems like a good idea if retaining the current behavior is needed.

    copy/move grew organically driven by popular demand and gathered some legacy. there is a slew of requests change behavior of copy/move to make it like windows/linux/whatever. otoh there is a good risk that if we do that, we'll get another wave of requests claiming rclone broke their processes in various tricky ways. thus the former requests get stuck in discussions about a myriad of ugly "--give-me-new-x-but-dont-break-his-old-y" flags and their combinations. they take a share of 600+ tickets, waiting for years. i'm not sure if having new commands is good or bad. hopefully it will get some "--x-y-blah" knots untangled.

    Although this ticket predates the other by quite a long time.

    if it helps this request get fullfilled eventually, so what's bad.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions