Sign in to follow this  
Followers 0
xuzo

How to FTP download in specific directory, tried InetGet but don't get it!

12 posts in this topic

Hi there,

I've looked at the InetGet tutorial but don't quite get it...

I would like to have ALL the files downloaded from the following URL

ftp://ibiblio.org/pub/multimedia/mutopia/BachJS/BWV16/Cantata_16_no_5/

In a folder that let's say I'd call "ftdownload" in my documents, the dowload location will never change so no need for a directory variable.

When I try the example in the tutorial nothign happens, IE doesn't open and I don't know where the files went or got downloaded or not?

THanks,

Bruno

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

It's the sript in the tutorial. I pressed F5 but nothing happened...

InetGet("http://www.mozilla.org", @TempDir & "mozilla.html")
InetGet("http://www.autoitscript.com", @TempDir & "autoitscript.html", 1)
InetGet("ftp://ftp.mozilla.org/pub/mozilla.org/README", @TempDir & "Mozilla-README.txt", 1)
; Advanced example - downloading in the background
Local $hDownload = InetGet("http://www.autoitscript.com/autoit3/files/beta/update.dat", @TempDir & "update.dat", 1, 1)
Do
Sleep(250)
Until InetGetInfo($hDownload, 2) ; Check if the download is complete.
Local $nBytes = InetGetInfo($hDownload, 0)
InetClose($hDownload) ; Close the handle to release resources.
MsgBox(0, "", "Bytes read: " & $nBytes)

Are the files dowloaded in @TempDir &

Where is that?

I also never got any popup message

Edited by xuzo

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I added tree lines after the original help sample.

I think, it is selfexplaining.

InetGet("http://www.mozilla.org", @TempDir & "mozilla.html")
InetGet("http://www.autoitscript.com", @TempDir & "autoitscript.html", 1)
InetGet("ftp://ftp.mozilla.org/pub/mozilla.org/README", @TempDir & "Mozilla-README.txt", 1)

; Advanced example - downloading in the background
Local $hDownload = InetGet("http://www.autoitscript.com/autoit3/files/beta/update.dat", @TempDir & "update.dat", 1, 1)
Do
Sleep(250)
Until InetGetInfo($hDownload, 2) ; Check if the download is complete.
Local $nBytes = InetGetInfo($hDownload, 0)
InetClose($hDownload) ; Close the handle to release resources.
MsgBox(0, "", "Bytes read: " & $nBytes)
MsgBox(262144," ","Three files are in directory: " & @TempDir & @CRLF & @CRLF & "Second file is in parent directory due to an error in the help sample (backslash missing)",0)
ShellExecute(@TempDir & ".." )
ShellExecute(@TempDir )
Edited by forumer100

My UDFs, Abbrevs and Snippets
If you like my post, just click the like button :) 

Share this post


Link to post
Share on other sites

Try the _FTPxx functions if you're looking to get files from an FTP site, or perhaps try putty or PSFTP from the putty site, which will get all files from a folder on a remote site quite easily.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Here are my failed attempts at making it work:

InetGet("ftp://ibiblio.org/pub/multimedia/mutopia/BachJS/BWV16/Cantata_16_no_5/", C:FTP_testing "ftp://ibiblio.org")

InetGet("ftp://ibiblio.org/pub/multimedia/mutopia/BachJS/BWV16/Cantata_16_no_5/", @TempDir & "ftp://ibiblio.org")
;Advanced example - downloading in the background
Local $hDownload = InetGet("http://www.autoitscript.com/autoit3/files/beta/update.dat", @TempDir & "update.dat", 1, 1)
Do
Sleep(250)
Until InetGetInfo($hDownload, 2) ; Check if the download is complete.
Local $nBytes = InetGetInfo($hDownload, 0)
InetClose($hDownload) ; Close the handle to release resources.
MsgBox(0, "", "Bytes read: " & $nBytes)
MsgBox(262144, " ", "Three files are in directory: " & @TempDir & @CRLF & @CRLF & "Second file is in parent directory due to an error in the help sample (backslash missing)", 0)
ShellExecute(@TempDir & "..")
ShellExecute(@TempDir)

InetGet("ftp://ibiblio.org/pub/multimedia/mutopia/BachJS/BWV16/Cantata_16_no_5/", @TempDir & "ftp://ibiblio.org")

#include <FTP.au3>; This line includes all the FTP functions you need. Open this file to see which functions contains exactly.
$server = 'ftp://ibiblio.org/pub/multimedia/mutopia/BachJS/BWV16/Cantata_16_no_5/'
;$username = 'secretusers'
;$pass = 'hiddenpass'
$Open = _FTPOpen('MyFTP Control')
;$Conn = _FTPConnect($Open, $server, $username, $pass)
$Ftpp = _FtpPutFile($Conn, 'C:WINDOWSNotepad.exe', '/somedir/Example.exe')
$Ftpc = _FTPClose($Open)

I looked in the temp folder for second attempt and ibiblio files weren't there...

I would also like to download to a simple path like C:FTP_testing or something instead of the temp

directory?

Additionally that FTP requires no password and username as it is public domain.

Edited by xuzo

Share this post


Link to post
Share on other sites

Well, even if the username and password aren't needed, they're still required, even if blank, for the function to work.

You have the username and pw variables commented out, so you're going to get an error for the _FTP_Connect, but you have THAT commented out as well.

Plus, there's no function called _FTP_PutFile, you probably meant to use _FTP_FilePut, but you actually shouldn't use it. If you're downloading from a site, you'd use _FTP_FileGet, because get means to GET the file. Put means to PUT (send) the file on the site.

Plus, there's no UDF called FTP.au3, it's FTPEx.au3.

How many errors did that script throw up when you "ran" it? Because as it is, it won't work at all because none of those function names are correct. Have you actually read the help file?


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Hi Brew Man,

Read the help files like crazy and only found a Youtube example in German I think!

http://www.youtube.com/watch?v=pnQIavFBt5Q actually a lot of the stuff on youtube is not in English...

Let me try another example. I'll post the code here in a few minutes, thanks.

Share this post


Link to post
Share on other sites

Ok here is the example I tried from the help file for _FTP_FileGet:

#include <FTPEx.au3>
_FTP_FileGet($l_FTPSession, $s_RemoteFile, $s_LocalFile [, $fFailIfExists = False, [$dwFlagsAndAttributes = 0 [, $l_Flags = 0 [, $l_Context = 0]]]])

Where do I put ftp://ibiblio.org/pub/multimedia/mutopia/BachJS/BWV16/Cantata_16_no_5/ in that code and where do I put C:FTP_testing folder (that's where I would like the files to go)

What to enter for the 3 following parameters?

$l_FTPSession as returned by _FTP_Connect() is it: (is this ftp://ibiblio.org/pub/multimedia/mutopia/BachJS/BWV16/Cantata_16_no_5/ ?) $s_RemoteFile The remote Location for the file. (is this ftp://ibiblio.org/pub/multimedia/mutopia/BachJS/BWV16/Cantata_16_no_5/ ?) $s_LocalFile The local file. (is this C:FTP_testing folder ?)

Then I tried this:

#include <FTPEx.au3>
_FTP_FileGet(ftp://ibiblio.org/pub/multimedia/mutopia/BachJS/BWV16/Cantata_16_no_5/, ftp://ibiblio.org/pub/multimedia/mutopia/BachJS/BWV16/Cantata_16_no_5/, C:FTP_testing folder [, $fFailIfExists = False, [$dwFlagsAndAttributes = 0 [, $l_Flags = 0 [, $l_Context = 0]]]])

I'm very new at this and stuggling...this URL doesn't require any login so anybody can do it, if someone could run it on their machine and then post the code to take me out of my misery!

Thanks

Share this post


Link to post
Share on other sites

It worked fine with the AutIT example but not with Ibiblo, I must be doing something wrong...but don't know what!

InetGet("ftp://ibiblio.org/pub/multimedia/mutopia/BachJS/BWV16/Cantata_16_no_5/", @TempDir & "Cantata_16_no_5-a4-pdfs.zip", 1)
Local $hDownload = InetGet("http://www.autoitscript.com/autoit3/files/beta/update.dat", @TempDir & "update.dat", 1, 1)
Do
Sleep(250)
Until InetGetInfo($hDownload, 2) ; Check if the download is complete.
Local $nBytes = InetGetInfo($hDownload, 0)
InetClose($hDownload) ; Close the handle to release resources.
MsgBox(0, "", "Bytes read: " & $nBytes)
MsgBox(262144, " ", "Files should be in there: " & @TempDir & @CRLF & @CRLF & "(Second file is in parent directory due to an error in the help sample (backslash missing)", 0)
ShellExecute(@TempDir & "..")
ShellExecute(@

Share this post


Link to post
Share on other sites

Ok got it working finally!

Problem was it needed to be http and not ftp for some reason...

Thanks for all!

Share this post


Link to post
Share on other sites

[sOLVED]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0