xuzo Posted July 2, 2012 Share Posted July 2, 2012 How to download all files in a folder or the whole folder in one shot? InetGet("ftp://ibiblio.org/pub/multimedia/mutopia/BachJS/BWV16/Cantata_16_no_5/", @TempDir & "Cantata_16_no_5-a4-pdfs.zip", 1) This works fine file by file. I tried and failed this for all zip files: InetGet("ftp://ibiblio.org/pub/multimedia/mutopia/BachJS/BWV16/Cantata_16_no_5/", @TempDir & "*.zip", 1) and failed also for all files: InetGet("ftp://ibiblio.org/pub/multimedia/mutopia/BachJS/BWV16/Cantata_16_no_5/", @TempDir & "*.*", 1) Thanks Link to comment Share on other sites More sharing options...
abberration Posted July 2, 2012 Share Posted July 2, 2012 First of all, you cannot take a bunch of separate files on a website and download them as a single zip file. However, you can open the page, get a list of all the links and download them. For my example below, I made it check if the link has an extension. If it does not have an extension, then it is leading to a different directory, so it won't attempt to download something that is not there. #include <File.au3> #include <Array.au3> #include <IE.au3> Global $tempLink, $drive, $dir, $file, $ext Local $oIE = _IECreate("ftp://ibiblio.org/pub/multimedia/mutopia/BachJS/BWV16/Cantata_16_no_5/") Local $oLinks = _IELinkGetCollection($oIE) Local $iNumLinks = @extended DirCreate(@DesktopDir & "\Downloads") For $oLink In $oLinks $tempLink = $oLink.href _PathSplit($tempLink, $drive, $dir, $file, $ext) If $ext <> "" Then Inetget ($tempLink, @DesktopDir & "\Downloads\" & $file & "." & $ext) EndIf Next BrewManNH and xuzo 2 Easy MP3 | Software Installer | Password Manager Link to comment Share on other sites More sharing options...
xuzo Posted July 3, 2012 Author Share Posted July 3, 2012 (edited) Hi Nsfw, This worked 100% perfectly on first try. Should be added to examples in help files actually! Cheers! Edited July 3, 2012 by xuzo Link to comment Share on other sites More sharing options...
iamsandeep Posted July 7, 2013 Share Posted July 7, 2013 guys, awesome piece of code. however i can see 2 things when I executed. 1. Inetget ($tempLink, @DesktopDir & "\Downloads\" & $file & "." & $ext) here $ext already holds the extn with a preceding ".", such as ".zip", so no need to add another extra &"."& in front of it. 2. I needed to download some .gz files from a public server so i tried to twik the code and run accordingly. but for some reason it's doing everything else but not downloading the file. can someone help me with the code? I'll be grateful as i'm almost out of options here other than banging my head on the wall. #include <File.au3> #include <Array.au3> #include <IE.au3> Global $tempLink, $drive, $dir, $file, $ext Local $oIE = _IECreate("ftp://ftp.wwpdb.org/pub/pdb/data/structures/divided/pdb/00") Local $oLinks = _IELinkGetCollection($oIE) Local $iNumLinks = @extended DirCreate("C:\Downloads") For $oLink In $oLinks $tempLink = $oLink.href _PathSplit($tempLink, $drive, $dir, $file, $ext) If $ext <> "" Then ConsoleWrite("in: "&$tempLink&@CRLF&$drive&@CRLF&$dir&@CRLF&$file&@CRLF&$ext&@CRLF) Inetget ($tempLink, "C:\Downloads\" & $file & $ext) ConsoleWrite("out: "&"C:\Downloads\" & $file & $ext&@CRLF) EndIf Next _IEQuit($oIE) Thanks guys. I know you guys are pro's and I hope someone will be able to rescue me out of this. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now