How to delete a file using scp


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to delete a file using scp
# 1  
Old 04-13-2010
MySQL How to delete a file using scp

Anyone can share some light how I can use openssh scp command to remove a remote file?
scp -u does not work in openssh scp...
# 2  
Old 04-13-2010
As far as I remember there is no delete option in openssh by default. I've seen patches which can help you, but I never tried them.

On the other hand you can always do ssh host 'rm -fr /your/file'

Regards,
-Artur.
# 3  
Old 04-13-2010
Quote:
Originally Posted by Artur Zaworski
As far as I remember there is no delete option in openssh by default. I've seen patches which can help you, but I never tried them.

On the other hand you can always do ssh host 'rm -fr /your/file'

Regards,
-Artur.

Thanks. My only concern is that the remote system might have set up for the account to be a ftponly account. In that case, can I still use the rm command?
# 4  
Old 04-13-2010
It's correct - eg. if you don't have shell you won't be able to run commands on remote host.

Regards,
-Artur.
# 5  
Old 04-13-2010
Quote:
Originally Posted by Artur Zaworski
It's correct - eg. if you don't have shell you won't be able to run commands on remote host.

Regards,
-Artur.

Thank you for your prompt replies. Since scp cannot delete, I think using sftp will be the next safest bet.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Windows & DOS: Issues & Discussions

scp to windows and delete files from windows

Hi Team, I Have list file in Unix server, I need to copy files from Windows to Unix for the list of files given in Unix list file. after coping files to unix, I need to delete the files from Windows. i used SCP and moved files from windows to unix based on list file is done and working.... (1 Reply)
Discussion started by: spradeep86
1 Replies

2. UNIX for Dummies Questions & Answers

scp and uncompress on the file?

Hi, Is there any way to do scp and uncompress on the fly? At the moment, I am doing scp and then running uncompress of the .Z files in the background. I am wanting to be able to do scp and then have the uncompress the .Z file in the background. Any advice much appreciated. Thanks in... (3 Replies)
Discussion started by: newbie_01
3 Replies

3. Shell Programming and Scripting

scp one file after another

Hi, I am looking to scp two files in one go, where the second file is sent only if the first one has been fully copied across. I know of the following command that is used to copy multiple files across to one destination server: cp file1.log file2.log user@servername:~/upload Will this... (3 Replies)
Discussion started by: brunlea
3 Replies

4. UNIX for Advanced & Expert Users

SCP File Transfer

On unix AIX server, when I am trying to transfer file from one directory to another directory on the same server through a program(where i call the script) it gives error "Lost Connection". (5 Replies)
Discussion started by: Pash
5 Replies

5. Shell Programming and Scripting

Avoiding file overwrite during file transfer using scp

Hi, I have written a small script to transfer a file from one unix server to other using scp command which is working fine. As I know with scp, if any file with the same name is already present on destination server, it would get overwritten without any notification to user. Could anyone help me... (14 Replies)
Discussion started by: dsa
14 Replies

6. UNIX for Advanced & Expert Users

SCP File Transfer

I have 3 AIX server namely - Server 1 , Server 2 and Server 3. And have done SCP setup between Server 1 and Server 2 so that i dont have to give password when i transfer file from Server 1 to Server 2 by setting public key between the server. Q1. If the unix password of the target server... (3 Replies)
Discussion started by: Pash
3 Replies

7. Shell Programming and Scripting

SCP and then touch .done file

All, I am looking to make a script and wanted to see if anyone could help out. The script will go through the directory, put a timestamp, transfer it and then create a touch $file.done script HEre is my initial idea, but I don't think it will work properly. Anyone able to help me refine it... (11 Replies)
Discussion started by: markdjones82
11 Replies

8. UNIX for Dummies Questions & Answers

File transfer using SCP

I have a shell script which uses SCP command to transfer the files from one server to another server. The files are getting transferred successfully, but the problem is the files transferred to the destination server didnot have the permissions as that of the files on the source server. Command... (5 Replies)
Discussion started by: kumarm
5 Replies

9. Shell Programming and Scripting

file transfer using scp..

Hi Frdz I have a problem like. I need to transfer a file from source to destination (different systems with different IPs) using "scp" command and before transfer the file i have to check the file is available in destination or not, if it is there no need to transfer, otherwise we have to... (5 Replies)
Discussion started by: KiranKumarKarre
5 Replies

10. UNIX for Dummies Questions & Answers

scp using a .shosts file

Hello, I'm trying to scp from the root user of machine A to the root user of machine B without being prompted for a password. On machine B, I created a .shosts file in the '/' directory with the following line: A root I attempt to copy a file using the following statement: scp... (2 Replies)
Discussion started by: kadishmj
2 Replies
Login or Register to Ask a Question