Using pipe in FTP session


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Using pipe in FTP session
# 1  
Old 01-07-2013
Using pipe in FTP session

Hi All , I want to use pipe in ftp session . Please let me know if there is any possibility

I have done FTP to a remote host with proper username and password
Now I want to take the latest file in a directory . The below is not workinf

Code:
ftp> ls -lrt  | tail -1

please let me know how can i achieve the same

Last edited by Scott; 01-07-2013 at 01:24 PM.. Reason: Code tags
# 2  
Old 01-07-2013
You can't. If your ftp even honors ls -lrt, it's giving you more than is required.

FTP is not shell. It is very simple and stupid.
# 3  
Old 01-07-2013
Hi Corona,
Thanks for your reply . I understand the below command is not valid in FTP session
Code:
ftp> ls -lrt  | tail -1

But is there any other way to find last updated file in a directory in remote host

Last edited by Scott; 01-07-2013 at 01:24 PM.. Reason: Code tags
# 4  
Old 01-07-2013
Sure, you can do that outside ftp.

Code:
ftp <<EOF | tail -n 1
<commands to login>
ls -lrt
quit
EOF

This is assuming your FTP honors ls -lrt.
# 5  
Old 01-07-2013
Code:
ftp> ls -lrt  |"tail -1"

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

FTP session not working on cron

Hi, I'm experiencing an issue with creating an ftp session via cron. I am creating an ftp session between a data server and a reporting tool. I have created the script wherein the data server begins the ftp session and puts files into the tool. I have used the .netrc files for this and I run... (10 Replies)
Discussion started by: robin.b
10 Replies

2. Shell Programming and Scripting

running a script in a ftp session

Hi guys, I am using a script that run ftp and transfer file from my source server to the destination server. Since i have transferred my files to the destination server, now i want to run a script at the destination server. Could you please help me regarding how to run a script in a ftp... (7 Replies)
Discussion started by: jaituteja
7 Replies

3. Shell Programming and Scripting

executing commands through FTP session

Dears, i want to execute unix commands through FTP session those commands like grep XXXXX file name > new file tar new file ..... etc Please let me know how to so thank you (3 Replies)
Discussion started by: faiz
3 Replies

4. UNIX for Dummies Questions & Answers

FTP Session

In FTP session, how could know the present working directory in local machine? pwd command gives the present working directory for remote machine only. (2 Replies)
Discussion started by: siba.s.nayak
2 Replies

5. Shell Programming and Scripting

running script in ftp session

Dear Friends, I have this script CAP2_Launcher on suntest server. this script needs two input files in order to process them and produces an output files. I've created .bat file from windows to access the server and transfer the input files needed by the script and execute the script then pull... (3 Replies)
Discussion started by: sfaqih
3 Replies

6. Shell Programming and Scripting

Running a script for every ftp session

Hello all, I have written a shell script which would prompt the user to enter some name and a folder would be created by that name. This script should run automatically when the users provide there credentials during a FTP session and for every FTP session. And after they have provided there... (5 Replies)
Discussion started by: h3llh0l3
5 Replies

7. Shell Programming and Scripting

Looping in FTP session

Hi I am trying rename multiple files in a remote location by connecting through FTP. How do i do this? I get error as for is not FTP command. I looked the FAQ for scripting but it is doesnt relate to my post. Please help. Thanks ftp -in >Error.log <<! open $HOST user $User $Pwd for... (2 Replies)
Discussion started by: appsguy616
2 Replies

8. Shell Programming and Scripting

display while in ftp session

Is there any command which displays date while i am in a ftp session? I tried the date command, but in vain ftp> date ?Invalid command ftp> Can someone please help me. Thanks (2 Replies)
Discussion started by: vivek_damodaran
2 Replies

9. Shell Programming and Scripting

Loops within ftp shell session

Hi guys, i need to script the sending of multiple files through one ftp session. I have done this so far: ---------------------------------------------------------------- #!/bin/sh USER=myuser PASSWD=mypass filenum=$1 x=0 ftp -n 159.167.95.199 <<SCRIPT user $USER $PASSWD binary while ... (4 Replies)
Discussion started by: zaff
4 Replies

10. UNIX for Dummies Questions & Answers

one time automated ftp session

How can an automated script be setup to run at a later time in the day. cron runs recurring tasks. I am interested in a one time process. I want to back up a number of files whenever I make changes to an application and ftp for backup purposes. The script to automate the zipping of files has... (1 Reply)
Discussion started by: msmkeml
1 Replies
Login or Register to Ask a Question