FTP problem to find file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting FTP problem to find file
# 15  
Old 05-28-2009
mget *.txt also doesnt work.......
mget * works but that pulls all files [including non txt files]
# 16  
Old 05-28-2009
Quote:
Originally Posted by RubinPat
mget *.txt also doesnt work
dude, at least post some errors or anything you see abnormal that you got if you have any. don't just say it doesn't work. how would we know?
# 17  
Old 05-29-2009
Sorry about that
mget *.txt
gives a warning that found no such list of files and pulls 0 byte file ...when i see that there exists a file in the ftp server..

Also I tried your other solution with grep: gives me a warning unknown command found

HOST='domain.com'
USER='yourid'
PASSWD='yourpw'

ftp -n $HOST <<END|grep *.txt
quote USER $USER
quote PASS $PASSWD

quit
END
done
# 18  
Old 05-29-2009
Quote:
Originally Posted by RubinPat
Sorry about that
mget *.txt
gives a warning that found no such list of files and pulls 0 byte file ...when i see that there exists a file in the ftp server..
then does it work when you do it manually?
make sure you change directory to where the files are. make sure globbing is turn on by using "glob on". make sure you use ftp -ni ( check man page for -i option information).
# 19  
Old 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
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

[Need HELP] Find aging file and auto FTP

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

2. Shell Programming and Scripting

Problem with embedded FTP command in Ksh - System Cannot find the specified path.

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

3. UNIX for Advanced & Expert Users

Using FTP to check whether file is completely FTP... plz find the description below

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

4. UNIX for Advanced & Expert Users

Problem in FTP of file with chinese chars

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

5. UNIX for Dummies Questions & Answers

UNIX FTP file problem

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

6. UNIX for Advanced & Expert Users

Large file FTP problem

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

7. UNIX for Dummies Questions & Answers

problem while making ftp of a large file

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

8. Shell Programming and Scripting

File Name Problem from FTP

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

9. Ubuntu

Debian (ubuntu) file problem after ftp

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

10. Shell Programming and Scripting

ftp UnixWare File Size Problem

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
Login or Register to Ask a Question