Pipe out ftp command to a file


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Pipe out ftp command to a file
# 1  
Old 10-10-2005
Question Pipe out ftp command to a file

hi there all the unix-gurus,

anyone can offer me some advise/help? i'm writing a ftp script and i need to spool out the output to a file but i'm facing some problems when i'm doing the following:

ftp -n <mail server> ${log_dir}/test_put.log << END
user <user_id> <password>
verbose
bin
# Before putting the A0 Data
pwd >> ${log_dir}/test_put.log
dir >> ${log_dir}/test_put.log

it gives me this output which i do not want:

drw-rw-rw- 1 ftp ftp 0 Oct 10 14:26 .
drw-rw-rw- 1 ftp ftp 0 Oct 10 14:26 ..

I don't see all the files listed.

Anyway to resolve this?

Thanks.
# 2  
Old 10-10-2005
When you do <<END you are sending the next lines into the ftp program. The ftp program knows what "dir" means while the shell does not. But the ftp program has no idea at all what "dir >> ${log_dir}/test_put.log" means. Yes, it knows "dir". But the rest of that lines is gibberish. Just do "pwd" and "dir". You are already sending the output of ftp into that log file.
# 3  
Old 10-10-2005
Hi Perderabo,

Many thanks for the solution. It works perfectly fine. Thanks again =)
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

awk command to split pipe delimited file

Hello, I need to split a pipe de-limited file based on the COLUMN 7 value . If the column value changes I need to split the file Source File Payment|ID|DATE|TIME|CONTROLNUMBER|NUMBER|NAME|INDICATOR 42156974|1137937|10/1/2018|104440|4232|2054391|CARE|1... (9 Replies)
Discussion started by: rosebud123
9 Replies

2. Shell Programming and Scripting

Find or ls with pipe to the command file

Hello all! I am trying to find the "Notes" backup from my iPhone in my folder ~/Library/Application\ Support/MobileSync/Backup/ which used to be in the sqlite file ca3bc056d4da0bbf88b5fb3be254f3b7147e639c. But since an update of the MacOS it is still there, but not updated anymore. (This is... (9 Replies)
Discussion started by: marek
9 Replies

3. Shell Programming and Scripting

sed command to replace a line in a file using line number from the output of a pipe.

Sed command to replace a line in a file using line number from the output of a pipe. Is it possible to replace a whole line piped from someother command into a file at paritcular line... here is some basic execution flow.. the line number is 412 lineNo=412 Now i have a line... (1 Reply)
Discussion started by: vivek d r
1 Replies

4. Shell Programming and Scripting

How to ignore Pipe in Pipe delimited file?

Hi guys, I need to know how i can ignore Pipe '|' if Pipe is coming as a column in Pipe delimited file for eg: file 1: xx|yy|"xyz|zzz"|zzz|12... using below awk command awk 'BEGIN {FS=OFS="|" } print $3 i would get xyz But i want as : xyz|zzz to consider as whole column... (13 Replies)
Discussion started by: rohit_shinez
13 Replies

5. Shell Programming and Scripting

FTP command to get most recent file

Hello Experts... dir of FTP will list all the files in the directory. Is there any command or option of dir that will give me the most recent file only? Since I couldn't find any such thing, I thought of creating a log file (of FTP results) and work on this log file to determine the most recent... (2 Replies)
Discussion started by: juzz4fun
2 Replies

6. Shell Programming and Scripting

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 ftp> ls -lrt |... (4 Replies)
Discussion started by: Sandeep Lade
4 Replies

7. UNIX Desktop Questions & Answers

How to grep and pipe to mput ftp

I am ptting the following into an FTOP script. date=`TZ="aaa24" date +'%Y%m%d'` # this gets Yesterday date . . . . mput < 'l | grep $Vdate' # the idea to grep a listing from a directory that has yesterday date in its file name then put it in the remote FTP server. How can I get it... (4 Replies)
Discussion started by: raouf@comcast.n
4 Replies

8. Shell Programming and Scripting

broken pipe for ftp file transfer

hi i am trying to connect to a remote server and trying to uploa a file. during upload i am getting ":Broken pipe" error please help (0 Replies)
Discussion started by: Satyak
0 Replies

9. UNIX for Dummies Questions & Answers

ftp command to get latest file

Hi, I would like an FTP command or series of commands to get only the latest file. Is that possible? Thanks in advance. (2 Replies)
Discussion started by: laiko
2 Replies

10. AIX

How to ftp a pipe file

ftp> put 75384.DT.pipe 75384.DT.pipe: not a plain file. ls -l 75384.DT.pipe prwxrwxrwx 1 aaa staff 308 Apr 01 12:26 75384.DT.pipe How to transfer this file to other machine? (3 Replies)
Discussion started by: rainbow_bean
3 Replies
Login or Register to Ask a Question