file transfer between two servers


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting file transfer between two servers
# 1  
Old 05-19-2009
file transfer between two servers

Hi Frdz, Can any one help me out. I have a issue like below.i have to write shell script in unix.

Server1 server2
====== =======
1.txt 1.txt
2.txt
3.txt

I have to copy the files from server1 to server2 only if the file is does not existed in server2, if the file existed in server2 leave that.

Thanx
# 2  
Old 05-19-2009
you had some recent posts regarding file transfers as well.. what have you tried?
# 3  
Old 05-19-2009
File server from one server to another server

I used the following script, but it is copying everytime eventhough the file is existed in the destination server. can u suggest me by modifying this script.


$FILES="$SOURCE_LOCATION/*"
check=`ssh -n -l kiran 141.172.19.11 " ls $DESTINATION_LOCATION/$FILES | wc -l"`
if [ $check == 0 ]; then
scp $SOURCE_LOCATION$FILENAME $DESTINATION_IP$DESTINATION_LOCATION
echo "File Transferred Successfully....."
else
echo "The file is already existed in the destination..Sorry"
fi

Thanx
# 4  
Old 05-19-2009
you should maybe try the tool "rsync"...
# 5  
Old 05-19-2009
File server from one server to another server

No Duke..I have to use scp only as per client requirements..
the problem is i have to iterate all the files in server1 and compared with server2 files. If the file is available in server2 skip the copy otherwise copy that file from server1 to server2
# 6  
Old 05-19-2009
get a list of all the files in server 2
Code:
ssh ...user@server2 "ls -1 /somedir/" | while read files
do
   # do something
done

# 7  
Old 05-19-2009
File server from one server to another server

How can check the server1 files with server2 files..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

File transfer

When using FTP to transfer a file from IBM iSeries family of servers client to a non IBM Iseries family server, files might have characters appear in the wrong format Eg | in Iseries and while transferring fro Iseries system to Linux , but instead of | it is showing as ?. Please advise (3 Replies)
Discussion started by: sudhainit
3 Replies

2. Solaris

Need to transfer files between 2 UNIX servers, with same folder permission

I need to transfer directories/files between 2 Unix servers, with same folder permission. I tried scp, but it retains the the permissions, but changes the owner of the directory/file to the user used to copy them to the destination. I don't want that to happen. If possible without any other... (6 Replies)
Discussion started by: Pandee
6 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. Programming

File transfer in C

HI Can anyone provide me with codes for file transfer server to client or vice versa? Also please explain how to compile those programs in ubuntu terminal as i am totally new to socket programming. Thanks (0 Replies)
Discussion started by: mayhemtrigger
0 Replies

5. Shell Programming and Scripting

Transfer between servers with intermediary

I need to FTP the file from A to C server via B server. So first I connect to B server and then from B I connect to c server and put the files but some how I am getting error. I am able to do this process manually but with the shell script I am able to connect to B server but not to C server .... (0 Replies)
Discussion started by: balakrni
0 Replies

6. Shell Programming and Scripting

File transfer

Hi All, it might not be an sound question, i have two server like A and B.. i want to transfer file from B to A ..here i have some questions.. 1) do we need to create private and public key to connect..and transferring files...from B to A..? 2) i tried with scp options like... (2 Replies)
Discussion started by: Shahul
2 Replies

7. UNIX for Dummies Questions & Answers

XFB file transfer

Hello everyone, Has anyone used XFB file transfer ... I have no idea of its working. Also if any of you could provide me with a link for its tutorials or its details that would be awesome. Thanks a lot. (0 Replies)
Discussion started by: Rajat
0 Replies

8. Shell Programming and Scripting

SFTP Transfer Across Multiple Servers

Hello everyone, Have a question which I'm not entirely sure about, but will ask anyway. We have three servers (A/B/C), 'A' being the local host, 'B' being a SFTP server on the DMZ, and 'C' being the intended remote host. The task is to transfer file/s from server 'A' to server 'C' via server... (0 Replies)
Discussion started by: Cameron
0 Replies

9. UNIX for Dummies Questions & Answers

Transfer the file

Dear all, Can anybody let me know how to automate a file transfer process to a remote m/c thru SFTP , automate means it will not prmpt for password. how i am going to achive this....and what all methods are available or tools are available ???? (2 Replies)
Discussion started by: manas_ranjan
2 Replies

10. Shell Programming and Scripting

file transfer

hi all how do i copy a file from one server to another thanks bkan77 (4 Replies)
Discussion started by: bkan77
4 Replies
Login or Register to Ask a Question