HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- ftp script
Operating System - HP-UX
1827953
Members
3472
Online
109973
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2002 07:56 AM
12-11-2002 07:56 AM
I have 3 files on FTP Server.
abc123.main
abc123.data
abc123.end
i will get the file name(abc123) from another file(/tmp/filenames)
$cat /tmp/filenames
abc123
now my requirement is
I need to check , whether 'abc123.end' exists on the FTP server(111.222.49.55)
if exists , then I need to grab the 2 other files(abc123.main,abc123.data)
----------
thanks in advance.
keeping you ahead of the learning curve
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2002 08:05 AM
12-11-2002 08:05 AM
Re: ftp script
Something like this:
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x1464c1c4ceddd61190050090279cd0f9,00.html
live free or die
harry
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x1464c1c4ceddd61190050090279cd0f9,00.html
live free or die
harry
Live Free or Die
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2002 08:14 AM
12-11-2002 08:14 AM
Solution
Do it with 2 FTP's (per fileset), and test for the file inbetween. eg: -
---
SERVER=ftpserver1
USER=ftpuser
PASS=ftppass
for FILE in `cat /tmp/filenames`
do
ftp -n $SERVER < user $USER $PASS
get ${FILE}.end
bye
EOF
if [ -f ${FILE}.end ]; then
ftp -n $SERVER < user $USER $PASS
get ${FILE}.main
get ${FILE}.data
bye
EOF
fi
done
---
---
SERVER=ftpserver1
USER=ftpuser
PASS=ftppass
for FILE in `cat /tmp/filenames`
do
ftp -n $SERVER <
get ${FILE}.end
bye
EOF
if [ -f ${FILE}.end ]; then
ftp -n $SERVER <
get ${FILE}.main
get ${FILE}.data
bye
EOF
fi
done
---
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2002 08:45 AM
12-11-2002 08:45 AM
Re: ftp script
Simon's script is almost perfect, but I'd add two very minor modifications:
- ftp -in instead of ftp -n to disable prompting, and
- choose the correct transfert mode... chnage TMODE to ascii or binary depending of the appropriate mode...
no need to give me points on what is, in fact, only nitpicking ;-)
SERVER=ftpserver1
USER=ftpuser
PASS=ftppass
TMODE=
for FILE in `cat /tmp/filenames`
do
ftp -in $SERVER < user $USER $PASS
$TMODE
get ${FILE}.end
bye
EOF
if [ -f ${FILE}.end ]; then
ftp -in $SERVER < user $USER $PASS
$TMODE
get ${FILE}.main
get ${FILE}.data
bye
EOF
fi
done
Cheers,
FiX
- ftp -in instead of ftp -n to disable prompting, and
- choose the correct transfert mode... chnage TMODE to ascii or binary depending of the appropriate mode...
no need to give me points on what is, in fact, only nitpicking ;-)
SERVER=ftpserver1
USER=ftpuser
PASS=ftppass
TMODE=
for FILE in `cat /tmp/filenames`
do
ftp -in $SERVER <
$TMODE
get ${FILE}.end
bye
EOF
if [ -f ${FILE}.end ]; then
ftp -in $SERVER <
$TMODE
get ${FILE}.main
get ${FILE}.data
bye
EOF
fi
done
Cheers,
FiX
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Support
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP