Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ScpMover to transfer to a temporary file and rename after completion #148

Open
TAlonglong opened this issue Dec 14, 2022 · 2 comments · May be fixed by #150
Open

ScpMover to transfer to a temporary file and rename after completion #148

TAlonglong opened this issue Dec 14, 2022 · 2 comments · May be fixed by #150
Assignees

Comments

@TAlonglong
Copy link
Collaborator

Feature Request

There could be an option using scp to transfer files to transfer the file to a temporary filename which get renamed upon completion.

Possible scenarios is when for some reason the transfer is interrupted for any reason you might get a valid filename with incomplete content.
Another is that you could think you have a complete file and start reading, when it's not complete.

@TAlonglong TAlonglong self-assigned this Dec 14, 2022
@pnuu
Copy link
Member

pnuu commented Dec 14, 2022

Related issue: #92

@TAlonglong
Copy link
Collaborator Author

So this is a bit more complex that I hoped for.
SCPClient only provides put https://github.com/jbardin/scp.py/blob/master/scp.py#L170-L171 , so the requested functionality needs to be implemented using exec_command https://github.com/paramiko/paramiko/blob/main/paramiko/client.py#L485-L492

so this can be something like this:

if transfere_temprary:
    ssh_tmp = ssh_connection.get_transport()
    ssh_tmp.exec_command("Copy from orig to remote tmp")
    if successful:
        ssh_tmp_exec_command("remote rename to remote orig")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants