- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- need help for ftp script
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-26-2004 02:45 AM
03-26-2004 02:45 AM
I have to write a ftp script in which I have to ftp files from NT (ftp server) to Unix. Verify the files are transferred and then delete the files on NT. I wrote a shell scirpt on Unix. Well the FTP and verification part is working. Now I have to delete the files on Windows box. For this protion I'm using the script as below. But it is not working. Basically it is not taking the inputs between ftp & END for ftp.
Can anyone help?
while read line
do
ftp -n ip / quote USER uname
quote PASS password
bin
cd dir
delete $line
bye
END
done < file_with_filenames_tobe_deleted
Thank you,
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2004 02:47 AM
03-26-2004 02:47 AM
Re: need help for ftp script
Thats how i do it.
Maybe just a cut and paste issue, but i never scripted with those slashes.
SEP
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-26-2004 02:49 AM
03-26-2004 02:49 AM
Re: need help for ftp script
It does not work with << in while loop.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2004 02:53 AM
03-26-2004 02:53 AM
Re: need help for ftp script
And me neither uses here docs. I use Net::FTP with perl
Enjoy, Have FUN! H.Merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2004 03:07 AM
03-26-2004 03:07 AM
Re: need help for ftp script
When I use the same script and take out the while loop and delete command in ftp and add other command like ls it works.
It is the << charaters that is causing in the while loop not to work.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2004 03:18 AM
03-26-2004 03:18 AM
Re: need help for ftp script
The forum is killing us.
Is the "END" word at the start of the line, or do you have leading spaces?
<< (here documents) need the trailing text, the mark, to be EXACT. No leading spaces, no trailing spaces
Enjoy, Have FUN! H.Merijn [ who hopes to have hit the nail ]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2004 03:31 AM
03-26-2004 03:31 AM
Re: need help for ftp script
The perl module mentioned is also very nice.
my here docs look something like this:
cat <
is
a
test
EOF
and I have never had any problems doing here docs just like that in loops.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2004 03:32 AM
03-26-2004 03:32 AM
Re: need help for ftp script
I agree with procura in really checking for spaces...
But if you don't like the here-document or your
shell is in bad mood, use a pipe:
for ..
do
echo "ftp-command
..." | ftp -n ip
done
mfG Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2004 03:35 AM
03-26-2004 03:35 AM
Re: need help for ftp script
#!/usr/bin/perl
use Net::FTP;
my $f = Net::FTP->new ("10.10.10.10");
$f->login ("user", "password");
$f->cwd ("dir");
while (<>) {
chomp;
$f->delete ($_);
}
-->8---
# remove.pl files to delete
or
# remove.pl file_with_list_of_files_to_delete
Enjoy, Have FUN! H.Merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2004 04:12 AM
03-26-2004 04:12 AM
Re: need help for ftp script
It is working. When I removed leading spaces from all lines in the while-do-done loop, it worked.
Thanks
-GK-
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2004 05:15 AM
03-26-2004 05:15 AM
SolutionLeading spaces don't show, but they are a killer to here documents.
/me hops around in joy to have seen this, even though the forum kills whitespace
Enjoy, Have FUN! H.Merijn [ Hoping Pete will read this and stresses it on the nag list ]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2004 04:29 AM
04-01-2004 04:29 AM
Re: need help for ftp script
How do I do this?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2004 05:54 AM
04-01-2004 05:54 AM
Re: need help for ftp script
Enjoy, Have FUN! H.Merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2004 07:10 AM
04-01-2004 07:10 AM
Re: need help for ftp script
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2004 07:18 AM
04-01-2004 07:18 AM
Re: need help for ftp script
--8<--- remove.pl
#!/usr/bin/perl
use Net::FTP;
my $f = Net::FTP->new ("10.10.10.10");
$f->login ("user", "password"); # Only _one_ logon
$f->cwd ("dir");
while (<>) {
chomp;
$f->delete ($_);
}
$ftp->quit (); # and _one_ logoff
-->8---
# remove.pl file_with_list_of_files_to_delete
Enjoy, Have FUN! H.Merijn