Rebol Talk Forum  |  Getting Started  |  Newbie Help  |  Topic: Downloading file, not knowing name
Pages: [1] Print
Author Topic: Downloading file, not knowing name  (Read 297 times)
alekz
Newbie
*
Offline Offline

Posts: 2


View Profile
Downloading file, not knowing name
« on: November 09, 2004, 08:07:11 PM »

Hi! I'm a Rebol newbie! :blink:

I'm trying to write a script that will download a file from a FTP directory.
The problem is that I the filename changes every couple of days (virus signature file).
BUT, there is a textfile in the directory that can help me, maybe...

Now, this is my "script": :mellow:

-------------------------------------------------------------------------------------------------
filnamn: read/lines ftp://ftpez.ca.com/pub/myeTrust/sigs/10.5/version.txt

filnamn: append "aup_" filnamn
append filnamn ".exe"

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

Maybe you can see what I'm trying to do?
I'm reading the file which tells me which is the latest version, e.g 1234.
The file I'm trying to download is named "aup_1234.exe"
Anyway I get so far that I have a variable which is a string containing the correct filename that I need to download.

How do I tell Rebol to download the file?
How can I now use the variable?
 :blink:
I tried this: write/binary %filnamn read/binary ftp://ftpez.ca.com/pub/myeTrust/sigs/10.5/%filnamn but that of course doesn't work for me...

If you know how to do this let me know, or if you know of a simpler way!
Thanks!
 
Logged
CarlRead
Full Member
***
Offline Offline

Posts: 105


View Profile
Downloading file, not knowing name
« Reply #1 on: November 10, 2004, 12:50:45 AM »

Okay, my approach....
Code:
url:  ftp://ftpez.ca.com/pub/myeTrust/sigs/10.5/
filnamn:  rejoin [%aup_ read join url %version.txt %.exe]
write/binary filnamn read/binary join url filnamn
Not tested, but I think that should work.

Note that when you JOIN or REJOIN values the value returned will be of the same type as the first one being joined.  This allows you to join different types of values and can usually allow you to have the value returned in the datatype you want and so there'll be no need to convert it.
Logged

- Carl Read
alekz
Newbie
*
Offline Offline

Posts: 2


View Profile
Downloading file, not knowing name
« Reply #2 on: November 10, 2004, 02:01:50 AM »

CarlRead, thank you very much!
I had to add /lines after read and then it worked flawlessly!
Logged
Pages: [1] Print 
Rebol Talk Forum  |  Getting Started  |  Newbie Help  |  Topic: Downloading file, not knowing name
Jump to:  

  
Quick Search...

Advanced search
  
Welcome, Guest. Please login or register.
Did you miss your activation email?
August 30, 2008, 06:52:29 AM
Username: Password: Session Length:
  

News: 01-09-08

Alpha version of REBOL 3 has been released!


  
2235 Posts in 583 Topics by 1757 Members
Latest Member: Xzycdysz

  Rebol Talk Forum | Powered by SMF 1.0.9.
© 2001-2005, Lewis Media. All Rights Reserved.

RT design by Defiant Pc