LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   I abort scp, how do I clean up? (https://www.linuxquestions.org/questions/linux-general-1/i-abort-scp-how-do-i-clean-up-610904/)

brian_p_sully 01-03-2008 01:58 PM

I abort scp, how do I clean up?
 
I am programaticly scp'ing a large file between two servers. For a variety of reaons (such as low disk space) this process can be aborted. When the scp client is killed the destination retains a partially transferred file. Since the file is incomplete I would like it to be automatically deleted. Is there a simple way to do this? I didn't seen any intuitive options on the scp man page.

anomie 01-03-2008 03:25 PM

There is probably a more proper way, but here is one idea:
Code:

$ scp bigfile user@host:~ || ssh user@host rm bigfile
(bash shell obviously.)


All times are GMT -5. The time now is 09:41 AM.