Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Vista General Discussion > FTP question

Reply
 
 
Paul H
Guest
Posts: n/a

 
      03-08-2009
If this is not the appropriate place for this question, please steer me
right.
I hope the following is understandable by one of you batch file Guru's.
I need to automate a process that has been running manually. It goes like
this:

1. Open a DOS window.

2. Change to the folder I want to receive the file into.

3. enter "ftp ftp.blahblahblah.com".

4. When prompted as follows, enter a User ID. The following 4 lines of text
are received, after a .2 second to maybe 10 or more second wait, then
wanting a User ID to be entered.

a) Connected to ftp.blahblahblah.com.
b) 220-Microsoft FTP Service
c) 220 WARNING: Unauthorized [snip] suspected.
c(User <ftp.blahblahblah.com:<none>>:
d) abc (I have entered the User ID "abc".

5. When prompted as follows, enter the password. The following 2 lines of
text are received after a variable length delay:

a)331 Password required for abc.
b)456xyz (I have entered the password "456xyz")

6. Cause the file to be retrieved. This will be prompted for by:

a)2130-WARNING: Unauthorized [snip] suspected.
b)230 User abc logged in.
c)ftp>
d)get MyNewFile.txt (I have entered "get MyNewFile.txt")

7. end the FTP session.



It's been quite a while since I did a DOS batch file, so I need help.
My 1st guess would be:
cd \new-in
echo off
ftp ftp.blahblahblah.com
ftp ftp.blahblah.com
wait for the prompt (somehow watching for specific text)
echo abc
wait for the prompt (somehow watching for specific text)
echo 456xyz
echo get MyNewFile.txt
echo quit
execute a local program to process the file just received.
exit

TIA, Paul


 
Reply With Quote
 
 
 
 
Paul H
Guest
Posts: n/a

 
      03-08-2009
If this is not the appropriate place for this question, please steer me
right. I also put this in the XP General area, because the process will run
on an XP machine for a while. Also, the Vista version had a couple typos I
have fixed.
I hope the following is understandable by one of you batch file Guru's.
I need to automate a process that has been running manually. It goes like
this:

1. Open a DOS window.

2. Change to the folder I want to receive the file into.

3. enter "ftp ftp.blahblahblah.com".

4. When prompted as follows, enter a User ID. The following 4 lines of text
are received, after a .2 second to maybe 10 or more second wait, then
wanting a User ID to be entered.

a) Connected to ftp.blahblahblah.com.
b) 220-Microsoft FTP Service
c) 220 WARNING: Unauthorized [snip] suspected.
c(User <ftp.blahblahblah.com:<none>>:

d) abc (I have entered the User ID "abc".

5. When prompted as follows, enter the password. The following line of
text is received after a variable length delay:

a)331 Password required for abc.

b)456xyz (I have entered the password "456xyz")

6. Cause the file to be retrieved. This will be prompted for by:

a)2130-WARNING: Unauthorized [snip] suspected.
b)230 User abc logged in.
c)ftp>
d)get MyNewFile.txt (I have entered "get MyNewFile.txt")

7. end the FTP session.



It's been quite a while since I did a DOS batch file, so I need help.
My 1st guess would be:
cd \new-in
echo off
ftp ftp.blahblahblah.com
wait for the prompt (somehow watching for specific text)
echo abc
wait for the prompt (somehow watching for specific text)
echo 456xyz
echo get MyNewFile.txt
echo quit
execute a local program to process the file just received.
exit

TIA, Paul


 
Reply With Quote
 
Synapse Syndrome
Guest
Posts: n/a

 
      03-08-2009
Paul H <> wrote:
>
> If this is not the appropriate place for this question, please steer me
> right.
> I hope the following is understandable by one of you batch file Guru's.
> I need to automate a process that has been running manually. It goes
> like this:
>
> 1. Open a DOS window.
>
> 2. Change to the folder I want to receive the file into.
>
> 3. enter "ftp ftp.blahblahblah.com".
>
> 4. When prompted as follows, enter a User ID. The following 4 lines of
> text are received, after a .2 second to maybe 10 or more second wait,
> then wanting a User ID to be entered.
>
> a) Connected to ftp.blahblahblah.com.
> b) 220-Microsoft FTP Service
> c) 220 WARNING: Unauthorized [snip] suspected.
> c(User <ftp.blahblahblah.com:<none>>:
> d) abc (I have entered the User ID "abc".
>
> 5. When prompted as follows, enter the password. The following 2 lines
> of text are received after a variable length delay:
>
> a)331 Password required for abc.
> b)456xyz (I have entered the password "456xyz")
>
> 6. Cause the file to be retrieved. This will be prompted for by:
>
> a)2130-WARNING: Unauthorized [snip] suspected.
> b)230 User abc logged in.
> c)ftp>
> d)get MyNewFile.txt (I have entered "get MyNewFile.txt")
>
> 7. end the FTP session.
>
>
>
> It's been quite a while since I did a DOS batch file, so I need help.
> My 1st guess would be:
> cd \new-in
> echo off
> ftp ftp.blahblahblah.com
> ftp ftp.blahblah.com
> wait for the prompt (somehow watching for specific text)
> echo abc
> wait for the prompt (somehow watching for specific text)
> echo 456xyz
> echo get MyNewFile.txt
> echo quit
> execute a local program to process the file just received.
> exit



I use batch scripts to copy files to FTP and cloud storage, but using
virtual drive letters provided by WebDrive or Gladinet. I've not used the
FTP console client. I'd ask in the server newsgroup where Pegasus MVP will
probably help you out.

ss.


 
Reply With Quote
 
VLaaD
Guest
Posts: n/a

 
      03-09-2009

Hi, I'll use the same domain name, user name and password you mentioned
I'm writing this pretty much from the top of my head (I wanted to tes
the script, but our local ISP's are still in hope that $200/Mo/root i
enough, resulting in frequent infrastructure malfunction :cry

Try with this (*ftp-batch.bat*
Code
-------------------
@echo off
ftp -d -a -n -s:ftp-batch.txt ftp.blahblahblah.com
*REM* put here processing program's command line
pause

-------------------
where *ftp-batch.txt* could contain something like this

Code
-------------------
quot USER abc
quot PASS 456xyz
quot PASV
quot CWD /new-in-server-side
lcd \new-in
quot TYPE I
quot RETR MyNewFile.txt
quot CWD /test1
lcd C:\new-in\test1
quot RETR MyNewFile_From_To_test1.txt
quit

-------------------


I really hope that this will work :geek

--
VLaaD
 
Reply With Quote
 
the wharf rat
Guest
Posts: n/a

 
      03-09-2009
In article <7A239355-2737-452D-A6A0->,
Paul H <> wrote:
>
>I hope the following is understandable by one of you batch file Guru's.
>I need to automate a process that has been running manually. It goes like
>this:


There are some things it's not worth fighting with batch files
over. You could use visual basic but frankly VB's a pain. Luckily
perl runs just fine on windows. This is all you'd need.

use Net::FTP;

$ftp = Net::FTP->new($host) ||
(die "Cannot open FTP session to $host\n");
$ftp->login($user,$pass) ||
(die "Login to $host as $user failed.\n");
$ftp->binary();
$ftp->get($pathtoremotefile,$pathtolocalfile) ||
(die "Put of $pathtolocalfile to $host failed.\n") ;
$ftp->quit;

Perl's much easier to learn than VB is so if you've never worked in it
this would be a good opportunity :-)


 
Reply With Quote
 
+Bob+
Guest
Posts: n/a

 
      03-09-2009
On Mon, 9 Mar 2009 10:08:22 +0000 (UTC), (the wharf
rat) wrote:

>In article <7A239355-2737-452D-A6A0->,
>Paul H <> wrote:
>>
>>I hope the following is understandable by one of you batch file Guru's.
>>I need to automate a process that has been running manually. It goes like
>>this:

>
> There are some things it's not worth fighting with batch files
>over. You could use visual basic but frankly VB's a pain. Luckily
>perl runs just fine on windows. This is all you'd need.
>
>use Net::FTP;
>
> $ftp = Net::FTP->new($host) ||
> (die "Cannot open FTP session to $host\n");
> $ftp->login($user,$pass) ||
> (die "Login to $host as $user failed.\n");
> $ftp->binary();
> $ftp->get($pathtoremotefile,$pathtolocalfile) ||
> (die "Put of $pathtolocalfile to $host failed.\n") ;
> $ftp->quit;
>
>Perl's much easier to learn than VB is so if you've never worked in it
>this would be a good opportunity :-)


I'd have to disagree with you in a major way there, Wharf. Perl is
convoluted, un-intuitive, cryptic, and difficult. Not that I don't
like it :-)


 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
VPN question Mario Lanza Windows Vista General Discussion 0 06-20-2007 09:32 AM
VPN Question DJ Windows Vista Networking 1 04-06-2007 06:46 AM
vista genral question and ultimate question pedro g Windows Vista General Discussion 7 02-10-2007 03:34 AM
Dual boot system question and family deal discount question Betatesterzz Windows Vista General Discussion 2 01-31-2007 01:25 PM
Another UAC question DocMAX Windows Vista General Discussion 4 11-14-2006 05:22 PM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59