Copy latest files from another server


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Copy latest files from another server
# 1  
Old 08-12-2011
Copy latest files from another server

Hi,
I wanted to copy monthly generated csv file(s)( of latest date) at one server to my current server.
So I wrote the following script, but does not work.
The script is invoked on my current server
Can you please help?
Code:
!/bin/ksh
#. /apps/comp/

cd /apps/di/dev/import/paper
ssh hpqad02
cd /apps/qad/tst/export/di
latest_file=find . -name "*.csv"
scp -p $latest_file qadsys@$hpqad02:/apps/di/dev/import/paper


Last edited by Franklin52; 08-13-2011 at 10:05 AM.. Reason: Please use code tags for data and code samples, thank you
# 2  
Old 08-12-2011
Try this :
Code:
!/bin/ksh
#. /apps/comp/

cd /apps/di/dev/import/paper
latest_file=`echo 'find /apps/qad/tst/export/di -name "*.csv"' | ssh hpqad02`
scp -p $latest_file qadsys@$hpqad02:/apps/di/dev/import/paper

hope you have ssh keys setup else need to give password.
# 3  
Old 08-12-2011
Sorry it fails to execute Smilie
# 4  
Old 08-13-2011
Can you please post the error you getting.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Modified or latest files copy from windows to Linux

To copy the file from windows to linux i use pscp command(pscp source user@destination). Know i want to copy the latest modified or created files from windows to linux. could any one please help me out with it. Thanks and Regards, Sourabh (2 Replies)
Discussion started by: SourabhChavan
2 Replies

2. Shell Programming and Scripting

Copy multiple .txt files from one server to another server

:wall:Hi all, I have two servers : server A and server B Weekly wise i use to receive files to server A to one particular location say /source/location . NOTE: In this location there will be other files also present other than these weekly arrival 18 files. My task : i need a... (7 Replies)
Discussion started by: karmegam
7 Replies

3. UNIX for Dummies Questions & Answers

[Solved] Need help to copy files to another server

Hi all, I need a shell script to compress and transfer only last modified(new) file from one linux server to another linux sever. the files i need to backup are 2 files .txt & .log which will be created in the same folder for every 3-4hrs and this script need to run once in 24hrs. so only... (5 Replies)
Discussion started by: basszzz
5 Replies

4. Shell Programming and Scripting

Copy files from Linux server to Windows server

Hi All, I am generating report in a Linux server and once the report is generated the report(.txt file) needs to be automatically saved in a Windows servers. So i am looking for a script to transfer the file automatically from Linux server to Windows server? Please advise. Thanks... (3 Replies)
Discussion started by: arunmanas
3 Replies

5. Shell Programming and Scripting

Copy folder and files from unix server to linux server

We would be migrating unix solaries to Linux redhat. Basically source is unix and target is linux. i would like to copy entire file system unix/source/* to target linux/souce/* but target linux has only folder setup so what ever files copied need to be placed in the linux server with same... (8 Replies)
Discussion started by: balajikalai
8 Replies

6. UNIX and Linux Applications

Need to copy the latest file from Unix server to Shared folder

Hi All, One job in unix server will generate .csv files daily. I need to copy the latest of these .csv file from the unix server to the shared drive/folder in windows through unix script. My shared folder will look something like W:\some folder(for example). Could any one of you please help... (3 Replies)
Discussion started by: jaya@123
3 Replies

7. UNIX for Advanced & Expert Users

Best way to Copy Files From One server to another server

Hi , I have two servers say server A and server B. I am generating some files in server A which I have to copy to Server B,what will be the best option and why it is better than the other( as I have to copy more than 3 GB data files daily) 1.FTP - I can't use FTP bcoz it's not allowed due to... (2 Replies)
Discussion started by: wangkc
2 Replies

8. UNIX for Dummies Questions & Answers

Copy files from remote server

Hi Friends, Could you please help me as per my requirement mentioned below ? I have to copy files from one unix server to another unix server, and the files that i need to copy from the remote server are only those which are modified/created Today from abc directory on the remote server (1 Reply)
Discussion started by: ramask
1 Replies

9. Shell Programming and Scripting

copy the latest file in the remote server's directory

Hi Expert Team, I performed the below piece of code to copy the latest file in the remote server's directory to the same server's other directory. But it is not working properly. How can i handle this? Can you please help me..? ssh ${REMOTE_USERID}@${REMOTE_HOSTNAME} "cp -p `ssh... (3 Replies)
Discussion started by: spkandy
3 Replies

10. Shell Programming and Scripting

copy files from remote server (B) to target server (A)?

Hi All, what is the comand to log off the remote server? I have 2 servers A, B. I need to find all files older than 7 days on server B and copy over to server A. My logic is: login the remote server: ================= ssh hostB cd /data/test find . -mtime -7 -ls | awk '{print... (4 Replies)
Discussion started by: Beginer0705
4 Replies
Login or Register to Ask a Question