shell script to get sftp files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting shell script to get sftp files
# 1  
Old 06-04-2010
shell script to get sftp files

did anyone knows a script to get a latest file in a folder,,i try to get the newest file at a folder via sftp and i want to make a crontab to do this once a day,,can someone give me the script to get the latest file??
# 2  
Old 06-05-2010
I'm willing to *help* you write it. but it's in the wrong section. I believe we have a section for shell scripting.

Hints:
You'll have to use an expect statement or a passwordless login (danger)
You'll have to play with commands in psftp to see what sort of things are possible with it to grab the newest files
You'll have to be willing to learn if you don't already know how to do something.
# 3  
Old 06-05-2010
moved to the scripting section.
# 4  
Old 06-05-2010
What do you have so far?
# 5  
Old 06-08-2010
actually i`ve done it by 80%,,i already succeed in get the latest file via sftp with my script,,but when i cron it,it`s not succeed.And when i cron to get "a file"(hardcode it) via sftp it works like a charm,,i don`t undestand why when i get the latest file via sftp with cron it doestn work,,any suggestion?
# 6  
Old 06-08-2010
Could you post the script? Could be a simple typo or not fully file path.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. HP-UX

Shell script to sftp files to file server.

Hi, I am looking for a shell script to sftp to a file server and copy all the files from a directory after the script is run. The server name should be a user input parameter and of-course the username/password as well. Rest all should be handled by the script. I tried with below snippet:-... (2 Replies)
Discussion started by: happysingh
2 Replies

2. Shell Programming and Scripting

Renaming multiple files in sftp server in a get files script

Hi, In sftp script to get files, I have to rename all the files which I am picking. Rename command does not work here. Is there any way to do this? I am using #!/bin/ksh For eg: sftp user@host <<EOF cd /path get *.txt rename *.txt *.txt.done ... (7 Replies)
Discussion started by: jhilmil
7 Replies

3. Shell Programming and Scripting

SFTP password through shell script.

Hi All, I would be happy, if someone help me on this that I have only SFTP ID and Password to transfer some log files from webserver boxes to SFTP server Anyone help me that how to pass the password parameter throough the shell scripts, since i don't have ssh login access on the SFTP... (2 Replies)
Discussion started by: l_gshankar24
2 Replies

4. Shell Programming and Scripting

Help With SFTP using shell script

Hi All, Scenario : How to securely FTP the text file from a particular location(in unix system) to the windows ftp server (my PL is suggesting to use SCP command to accomplish this). Detailed description: I have created a Oracle job and scheduled it in dbms_scheduler. The job will invoke... (3 Replies)
Discussion started by: Sachi Vasishta
3 Replies

5. Shell Programming and Scripting

SFTP Shell script

Hi All, I have done the Private - Public keys generation( and sharing) and have written a script for automating the SFTP. Need to make sure if it will work: sftp.sh #!/bin/bash . config.ini sftp $SFTP_USER@$SERVER <<EOF cd $SFTP_RDIR #ls -lrt | grep $SFTP_RFILE | wc -l get... (2 Replies)
Discussion started by: Arpit Narula
2 Replies

6. Shell Programming and Scripting

SFTP-how to log individual sftp command error while executing shell script

Hi, I have situation where i need to automate transferring 10000+ files using sftp. while read line do if ; then echo "-mput /home/student/Desktop/folder/$line/* /cygdrive/e/folder/$line/">>sftpCommand.txt fi done< files.txt sftp -b sftpCommand.txt stu@192.168.2.1 The above... (1 Reply)
Discussion started by: noobrobot
1 Replies

7. Shell Programming and Scripting

Reg sftp in shell script

Hi, I want to retrieve files from an sftp site and place it a directory in unix server. When I try to connect, it is asking password even if i hardcode it in the script.I want to automate the script. Could anyone tell me how to avoid password prompt. #!/bin/sh # sample automatic ftp script... (3 Replies)
Discussion started by: vidhya_vec
3 Replies

8. Shell Programming and Scripting

SFTP shell script help

HI I need to write script to transefer files from windows server to UNIX and visa versa.... can any one enroute to the solution ........? I am new to SFTP .. would requst you provide some helpful informaion, Basics of SFTP also appreciated Thanks in Advance. Madan (1 Reply)
Discussion started by: madankumar
1 Replies

9. Shell Programming and Scripting

sftp shell that will validate files

Hi. I've written a shell that will sftp about 5,000 to 10,000 files a day (they are small 200 byte files). Where I'm stuck at is that I need to not only copy those files from the ftp server, I also need to delete the files on the ftp server after they have been ftped BUT before they've been... (0 Replies)
Discussion started by: biglarrrr
0 Replies

10. Shell Programming and Scripting

korn shell + sftp + list files

Hello!!! I need a korn shell script in AIX that inside sftp environment, changes a remote directory, lists the files inside it, and stores in an array. I got it working before make a sftp, but after.. I can't.. The way it is, it lists the files in local path... so.. not what I want, but... (1 Reply)
Discussion started by: alienET
1 Replies
Login or Register to Ask a Question