- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: ftp scripting (?) question
Categories
Company
Local Language
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
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
Community
Resources
Forums
Blogs
- 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
03-15-2005 11:02 PM
03-15-2005 11:02 PM
I need to send files from unix to windows 2000 ftp server.
I use the following comands:
ftp
open
anonymous
email@domain.com
mput *.ema
y
But I need to send a lot of files and I want to automate it. Help me!
Lima.
Solved! Go to Solution.
- Tags:
- ftp
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2005 11:08 PM
03-15-2005 11:08 PM
SolutionWon't happen unless your windoze box has an ftp daemon process running.
You can frp FROM your windoze box to GET the file.
If you DO have an ftp enabled windoze box, then on the unix system have a script like this:
...
/usr/bin/ftp -i -n WINDOZEbox.com << EOF
user "anonymous" "SOMEemailaddr"
bin
mput *.ema
EOF
live free or die
harry d brown jr
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2005 12:45 AM
03-16-2005 12:45 AM
Re: ftp scripting (?) question
There are two methods:
First is to install the latest version of WS-ftp on your windows-can. That way you can schedule ftp transfers.
Second is to create a tarball of all the files you need and ftp the tar-ball to your windows-can.
On windows you can untar i.e. by using winzip from the command-line in a batch script
Cheers,
Renarios
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2005 12:54 AM
03-16-2005 12:54 AM
Re: ftp scripting (?) question
you also want the "prompt" command prior to the mget, to avoid being asked to confirm each file.
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2005 02:41 AM
03-16-2005 02:41 AM
Re: ftp scripting (?) question
try this
usr/bin/ftp -i -n -v < /dir/ftp_connect.txt
cat ftp_connect.txt
open 10.32.113.177
user anonymous qq@qq.com
bin
hash
prompt off
cd dir
mput *.ema
bye
rgds Jan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2005 02:55 AM
03-16-2005 02:55 AM
Re: ftp scripting (?) question
#!/usr/bin/expect -f
#
spawn ftp
expect "Name"
send "anonymous\r"
expect "Password:"
send "email@domain.com\r"
expect "ftp>"
send "binary\r"
expect "ftp>"
send "mput *.ema\r"
expect "mput"
send "y\r"
expect "ftp>"
send "exit\r"
exit
Regards,
Sergejs
- Tags:
- expect
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2005 03:00 AM
03-16-2005 03:00 AM
Re: ftp scripting (?) question
# Make a file list.
ls -1 /tmp/filelist
while read -r filename
do
/usr/bin/ftp -i -n WINDOZEbox.com << EOF
user "anonymous" "SOMEemailaddr"
bin
put $filename
done < /tmp/filelist
This way is pretty flexible, but it does fire up the ftp process for every file transfer. It does insure there will be no accidental user interaction.
SEP
EOF
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2005 02:39 AM
03-17-2005 02:39 AM
Re: ftp scripting (?) question
I have made some generic references to host/vendor names and such but the script builds the .netrc file on the fly with the appropriate entries to put multiople files to that server.
Richard
#!/usr/bin/sh
#
create_netrc() {
ROUTINE="::create_netrc:"
cat > $HOME/.netrc<
login ${FTP_LOGIN}
password ${FTP_PASSWD}
macdef init
ha
as
prompt
verbose
lcd ${DIR}
mput ${FILENAME}
bye
EOF
check_error
}
get_file() {
ROUTINE="::get_file:"
ftp -g ${VENDOR_FTP} >$OFILE 2>&1
check_error
}
move_file() {
cd ${DIR}
mv * archive >$OFILE 2>&1
check_error
}
check_error() {
STATUS=`echo $?`
if [ ${STATUS} != 0 ]
then
mailx -s"`hostname`: ${VENDOR} Download Failed" ${MAILBOX} <
The following ERROR CONDITION occured during $ROUTINE: $STATUS
The above error code resulted in the following error message:
*** `cat $OFILE`
EOF
exit $STATUS
fi
}
if [ -r /.netrc ]
then
rm /.netrc
fi
FTP_LOGIN="anonymous"
FTP_PASSWD="root"
MAILBOX="root"
VENDOR="ftp"
VENDOR_FTP="ftp_ftp"
OFILE="/tmp/${VENDOR}_output"
DIR="/mnt/transfer/${VENDOR}"
DATE=`date +%m%d%Y`
FILENAME="PS_${DATE}"
create_netrc
chmod 0600 /.netrc
get_file
move_file