Replace FTP with SCP


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Replace FTP with SCP
# 1  
Old 05-20-2008
Replace FTP with SCP

Hi All,

I was using FTP for transferring files from remotemachine.
Code below:

# FTP for Customercare log
#*************************

cd $TRACKING_LOGDIR
ftp -n $CUSTCARE_SERVER << END_INPUT >> $TRACKING_LOGDIR/ftp_custcare.log 2>&1
user $CUSTCARE_USER $CUSTCARE_PWD
asc
cd $CUSTCARE_HOME
prompt
mget $CUSTCARE_LOG.* // getting all log files
mdelete $CUSTCARE_LOG.* // deleting the logfiles after getting
cd arch
mput $CUSTCARE_LOG.* // putting the logfiles to archive directory
bye
END_INPUT


Now i need to replace FTP with SCP.
I have SSH key/certificate authorization for login.
How can i replace the entire code by SCP?

Thanks and Regards,
# 2  
Old 05-20-2008
This is the general syntax for scp:

scp [options] [[user@]host1:]filename1 ... [[user@]host2:]filename2

In your case , the command should be something like:

scp -p [[root@]host1:]/$CUSTCARE_HOME/$CUSTCARE_LOG.* [[root@]host2:]*


I guess you have a option in SCP which would delete the files from the original location, once they are copied to the desired location.

Please check man pages for scp for more details.
# 3  
Old 05-20-2008
Hi All,

i tried following scp commands for moving :
scp user@host:file1 file2
scp file1 user@host:file2

Its working fine..

how can i delete the files after successful transfer in scp ?

Thanks and Regards,
# 4  
Old 05-20-2008
If your scp doesn't have an option for that (mine doesn't; openssh on Ubuntu) you will simply have to ssh to the remote host and issue a separate rm command.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Replace FTP with SFTP

Hi All, I am in the process of replacing SFTP instead of FTP to make data more secure. In one of my FTP script I have Quote Site command. I would like to know, what is the option to replace this in SFTP ftp -n -v <<! | tee -a $LOG | grep "Transfer complete" >/dev/null open... (3 Replies)
Discussion started by: desai.vishnu
3 Replies

2. Shell Programming and Scripting

FTP - SCP

Hi Team, When an FTP is success, code 226 is returned. Is there a possibility of return of code 226, when a part of file is transmitted to remote server. SCP do not return any codes but exit with status 0. This is what i found after executing SCP with verbose option. Is there a possibily... (2 Replies)
Discussion started by: forums123456
2 Replies

3. Shell Programming and Scripting

FTP/SFTP/SCP Files

Hi, I have a process which FTP's the files from one server to another server. Sometimes only half or a part of the file is delivered to remote location, but on the end log says FTP is successful. But ideally file in full is not delivered to remote location. How can i catch these kind of errors... (2 Replies)
Discussion started by: forums123456
2 Replies

4. HP-UX

[Solved] Unable to rename file in ftp server .Net:FTP perl

Hello All, I am trying to connect to ftp server and get the files. Also i need to rename the file in other ftp dir. rename method is not allowing me to rename the file in other dir. When i tried copy command by using net::FTP:FILE then perl says it is not installed. Can some body help me to... (2 Replies)
Discussion started by: krsnadasa
2 Replies

5. UNIX for Dummies Questions & Answers

Ftp/scp Command Error

Hi, How to use ftp/scp command with password containing @ symbol. Ex: ftp xyz:xyz@sun@11.211.111.11:/export/backups/ Exception I got: unknown host or invalid literal address Note: I dont want to change the password. Regards, Vinodh' Kumar (5 Replies)
Discussion started by: vino_hymi
5 Replies

6. Linux

Need SCP script equivalent to FTP script .

Hi, Currently i'm using the folllowing FTP acript and its working. echo "open $server" > ftp_file echo "user $user $password" >> ftp_file echo "cd $remote_dir" >> ftp_file echo "lcd $local_dir" >> ftp_file echo "put $file">> ftp_file echo "bye" >> ftp_file ftp -nv < ftp_file I've... (1 Reply)
Discussion started by: vickramshetty
1 Replies

7. UNIX for Advanced & Expert Users

problem while doing Large file transfer thru Scp and FTP

Hi , I want to transfer one file having 6GB(after compression) which is in .cpk format from one server to other server. I tried scp command as well as FTP and also split the file then transfer the files thru scp command. At last i am facing the data lost and connection lost issue. Generally it... (2 Replies)
Discussion started by: Sumit sarangi
2 Replies

8. UNIX for Dummies Questions & Answers

SCP -r from Secure FTP site

Hi all, My problem is simple. I would like to download the contents of a directory on an ftp site. I can access the site through windows, but there are many files and it would be too tedious to click and download each file. Thus, I am trying to use scp -r... (5 Replies)
Discussion started by: cpabrego
5 Replies

9. UNIX for Advanced & Expert Users

Using FTP to check whether file is completely FTP... plz find the description below

Hi, We have some clients who will place huge files in to one of the remote server. And the shell script written in our local server to retrieve client files (using FTP) placed on one of the remote server of ours by clients. My question Is there any FTP command/script to check from my local... (1 Reply)
Discussion started by: nmsrao
1 Replies

10. Shell Programming and Scripting

Modify FTP script to have SCP

Hi, I have an existing FTP script and I am trying to modify this to do SCP rather than FTP. I checked the man help in SCP and still having a hard time doing this... Current FTP script.. ftp -n << EOF > $LOG_FILE verbose open ${SERVER} $LOGON cd ${REMOTE_FILE_PATH} get... (2 Replies)
Discussion started by: madhunk
2 Replies
Login or Register to Ask a Question