Skip to content

Use sftp RENAME instead of copy and delete in case of moving a file #40

Description

@florian-dacosta

Hello,
I use fsspec to have a single api to work with multiple different storage backend.
I ran into some issues with the sftp implementation because the move method is used and fails with the error : asyncssh.misc.ChannelOpenError: Session request failed trying to do a cp command here https://github.com/fsspec/sshfs/blob/main/sshfs/spec.py#L162

From what I understand the cp command is not always (rarely ?) possible on sftp protocol and the posix_rename is not always supported either.
Would it be possible to replace this to copy and then remove the file by a sftp rename ?
In my case, that did fix the issue and this is the approach used for example in the fs.sshfs implementation. (https://github.com/althonos/fs.sshfs/blob/master/fs/sshfs/sshfs.py#L279)
And it seems quite easy since the rename is already implemented in asyncssh.
I could do a PR about it is an acceptable change.

Activity

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

    effort-smallHours: localized fixenhancementNew feature or requestp2-mediumMedium priority: real issue with workarounds

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions