05-29-2009
You can't do if then else inside an ftp command. Whenever you do "ftp << END" then anything in between has to be an ftp command. So you have to manually do the ftp command to see what commands to perform then from the results perform your task to check if the results are what you expect. For example to get a listing of a file called filename do your ftp command something like this
filename="/home/paul/myfile.tar.gz"
hostname="
ftp.myhost.com"
username="username"
password="password"
ftp -un $hostname <<EOF > ftpresults
quote USER $username
quote PASS $password
dir $filename
quit
EOF
test=`grep -c $fliename ftpresults`
if [ $test != 0 ]
then
echo "FILE EXITS"
Perform function here
else
echo "FILE doesn't exist"
fi
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi Engg. ! :cool:
When I am trafering a file through ftp from windows to UNIX having size about 1.24 GB then at the end of file transfer I got a error message "Extended file size limit (coredump)" and finnally ftp stop, whenever on other UNIX server the same file from windows... (1 Reply)
Discussion started by: Niraj Gopal Sha
1 Replies
2. Ubuntu
Hi,
I am using Debian (ubuntu). whenever I ftp file from Windows to Debian, the file is being shown as DOS while editing in vi. The control characters are not visible and I couldn't remove the '^M' character. So please help me how to make it Linux specific file to use it for Linux specific tasks. (4 Replies)
Discussion started by: royalibrahim
4 Replies
3. Shell Programming and Scripting
Hi, there. I am new to UNIX and I am writing a script that it uses the FTP to get a list of the files from the FTP server, and compares this list with the local folder to check if the file already exists. If not exist, then it connects to the FTP server again to download the files
The problem is... (1 Reply)
Discussion started by: czbtony
1 Replies
4. UNIX for Dummies Questions & Answers
Hi Friends,
I'mfacing a problem while doing ftp of a large file.The control session is getting closed after sometime.But data session transfers the file successfully even when the control seeion is lost.I need to make the control session available as long as data session is active.
How can i... (1 Reply)
Discussion started by: rprajendran
1 Replies
5. UNIX for Advanced & Expert Users
We are experiencing a problem on a lengthy data transfer by FTP through a firewall. Since there are two ports in use on a ftp transfer (data and control), one sits idle while the other's transfering data. The idle port (control) will get timed out and the data transfer won't know that it's... (3 Replies)
Discussion started by: rprajendran
3 Replies
6. UNIX for Dummies Questions & Answers
Hi, I am new to this forum.
I have a problem and I ws hoping you guys can help me out here.
the problem: I have a batch job running on a Unix Server, and it transfers files from the unix server to another server. the series of commands are as follows:
> LS Listing the files
> Logging into... (4 Replies)
Discussion started by: Vanilmirth
4 Replies
7. UNIX for Advanced & Expert Users
Hi,
I have a file in my PC with Chinese (PRC) characters. When I transfer that file into my AIX5.3 server through FTP, I get junk characters instead of Chinese chars. Last week I copied the content from my notepad and pasted in vi editor. The Chinese characters were correct, but when I try now,... (4 Replies)
Discussion started by: carthyc
4 Replies
8. UNIX for Advanced & Expert Users
Hi,
We have some clients who will place huge files in to one of the remote server.
And the shell script written in our local server to retrieve client files (using FTP) placed on one of the remote server of ours by clients.
My question Is there any FTP command/script to check from my local... (1 Reply)
Discussion started by: nmsrao
1 Replies
9. Shell Programming and Scripting
I have the following FTP embedded in a Ksh script on AIX 5.3
ftp -n <<WHATEVER
open 10.101.26.218
user hcistats *******
ascii
put $thupdatefile
put $thcollectfile
quit
WHATEVER
Here is what my script returns:
... (3 Replies)
Discussion started by: troym72
3 Replies
10. Shell Programming and Scripting
Dear Experts,
I have script to find aging file like this:
find /ArchiveINTF/INTF name "*" -type f -mtime +365 {} \; >> agingfile.txt
This script will find all files over 365 days.
But, I have problem, how to auto FTP all files?
Thanks
Edy (3 Replies)
Discussion started by: edydsuranta
3 Replies
LEARN ABOUT OPENSOLARIS
ftp
ftp(4) File Formats ftp(4)
NAME
ftp - FTP client configuration file
SYNOPSIS
/etc/default/ftp
DESCRIPTION
Use the ftp file to configure the behavior of the FTP client. Lines that begin with a hash symbol ("# ") are treated as comment lines and
are ignored.
Behavior Directives
The ftp file supports the following behavior directives:
FTP_LS_SENDS_NLST=yes | no The ls command of the ftp client sends an NLST to the FTP Server by default. Several non-Solaris clients send
LIST instead. In order to make the Solaris ftp client send LIST when the ls command is issued, set
FTP_LS_SENDS_NLST to no. The value of FTP_LS_SENDS_NLST is yes by default.
If the user sets a value for FTP_LS_SENDS_NLST in the user's environment, this value will override any FTP_LS_SENDS_NLST directive that is
specified in /etc/default/ftp.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWbipr |
+-----------------------------+-----------------------------+
SEE ALSO
ftp(1), attributes(5)
SunOS 5.11 22 Oct 2002 ftp(4)