scp one file after another


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting scp one file after another
# 1  
Old 05-14-2013
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:

Code:
cp file1.log file2.log user@servername:~/upload

Will this command transfer file2.log after file1.log has been sent completely, or will the transfer be done concurrently?

Is there a method where i can send a second file after the first one has been sent completely?

Thanks
# 2  
Old 05-14-2013
Hello,

The below command will be sending files one after the other.
Code:
scp file1.log file2.log user@servername:~/upload/

If you have a good list of files then just use a simple for loop

Code:
cat > list
file1
file2
file3
.....

Code:
for i in `cat file`; do scp $i user@servername:~/upload/; done

Hope this helps.

Cheers,
Kochappa
This User Gave Thanks to Kochappa For This Post:
# 3  
Old 05-14-2013
Quote:
Originally Posted by Kochappa
Hello,

The below command will be sending files one after the other.
Code:
scp file1.log file2.log user@servername:~/upload/

So i guess this means that if there is any problem in sending file1.log completely (or file2.log), then there will be an error output from the scp command? If so, then this servers my purpose well as there are only 2 files that i need to send one after the other.

Thanks
# 4  
Old 05-14-2013
Quote:
Originally Posted by brunlea
So i guess this means that if there is any problem in sending file1.log completely (or file2.log), then there will be an error output from the scp command? If so, then this servers my purpose well as there are only 2 files that i need to send one after the other.

Thanks
Yes, you will be seeing the progress bar and % of each file copied to the remote location. If any error happens then it must be visible on screen. For eg: if the second files does not exist it throws "No such file or directory"
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. UNIX for Advanced & Expert Users

scp command for file transfer

I am not able to throw a file from server173 to server067 i.e. wlsuser@server173> scp /tmp/harsha.txt wlsuser@server067:/tmp fails However, I am able to pull a file from server173 onto server067's /tmp dir wlsuser@server067> scp wlsuser@server173:/tmp/harsha.txt /tmp... (2 Replies)
Discussion started by: shifahim
2 Replies

6. Shell Programming and Scripting

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... (4 Replies)
Discussion started by: Leion
4 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