Jump to content

Get all files in URL folder


corgano
 Share

Recommended Posts

How would I make a script get all the files in a url, say here, and have my program list all the files in that directory?

Edited by corgano

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Link to comment
Share on other sites

Assuming that any additional files on that page will follow the same format:

#include <Array.au3>
#include <IE.au3>

$oIE = _IECreate ("http://corgano.co.cc/new/")
$sHTML = _IEDocReadHTML ($oIE)

$sRegExp = StringRegExp ($sHTML, '(?:\"\>)(.*)(?:\<\/A>)', 3)
If @error Then MsgBox (0, "", @error)
_ArrayDisplay ($sRegExp)

For $x = 1 To UBound($sRegExp)-1
    MsgBox (0, "", $sRegExp[$x])
Next
Link to comment
Share on other sites

Assuming that any additional files on that page will follow the same format:

#include <Array.au3>
#include <IE.au3>

$oIE = _IECreate ("http://corgano.co.cc/new/")
$sHTML = _IEDocReadHTML ($oIE)

$sRegExp = StringRegExp ($sHTML, '(?:\"\>)(.*)(?:\<\/A>)', 3)
If @error Then MsgBox (0, "", @error)
_ArrayDisplay ($sRegExp)

For $x = 1 To UBound($sRegExp)-1
    MsgBox (0, "", $sRegExp[$x])
Next

Any way of doing it without opening internet explorer? (or any other window)

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Link to comment
Share on other sites

If you're trying to avoid opening an IE window... Would you be able to at least save a file to the computer with INetGet and then read it in with _FileReadToArray and then parse it out like I did, or do you need to get the html completely without saving something to the computer?

***Edit - I would also point out that you can have that IE window be hidden if you change the _IECreate to _IECreate ("http://corgano.co.cc/new/", 0, 1), you'd just want to add _IEQuit($oIE) to the end of what I posted so you didn't end up with orphaned iexplore.exe processes.

Edited by exodius
Link to comment
Share on other sites

If you're trying to avoid opening an IE window... Would you be able to at least save a file to the computer with INetGet and then read it in with _FileReadToArray and then parse it out like I did, or do you need to get the html completely without saving something to the computer?

***Edit - I would also point out that you can have that IE window be hidden if you change the _IECreate to _IECreate ("http://corgano.co.cc/new/", 0, 1), you'd just want to add _IEQuit($oIE) to the end of what I posted so you didn't end up with orphaned iexplore.exe processes.

I tried to have the window hidden ($oIE = _IECreate ("http://corgano.co.cc/new/",0,1))but it didnt work.

What would I use inetget on?

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Link to comment
Share on other sites

My bad, I gave you the wrong code for the _IECreate, what I gave you would have told it to make it be visible instead of hidden.

This should work:

#include <Array.au3>
#include <IE.au3>

$oIE = _IECreate ("http://corgano.co.cc/new/", 0, 0)
$sHTML = _IEDocReadHTML ($oIE)

$sRegExp = StringRegExp ($sHTML, '(?:\"\>)(.*)(?:\<\/A>)', 3)
If @error Then MsgBox (0, "", @error)
_ArrayDisplay ($sRegExp)

For $x = 1 To UBound($sRegExp)-1
    MsgBox (0, "", $sRegExp[$x])
Next

_IEQuit($oIE)
Link to comment
Share on other sites

You could do this too:

#include <Array.au3>

$varOutput = "temp.html"

InetGet ("http://corgano.co.cc/new/", $varOutput)
$varFile = FileRead ($varOutput)

$sRegExp = StringRegExp ($varFile, '(?:\"\>)(.*)(?:\<\/a>)', 3)
If @error Then MsgBox (0, "", @error)
_ArrayDisplay ($sRegExp)

For $x = 1 To UBound($sRegExp)-1
    MsgBox (0, "", $sRegExp[$x])
Next

FileDelete ($varOutput)
Edited by exodius
Link to comment
Share on other sites

  • 3 months later...

You could do this too:

#include <Array.au3>

$varOutput = "temp.html"

InetGet ("http://corgano.co.cc/new/", $varOutput)
$varFile = FileRead ($varOutput)

$sRegExp = StringRegExp ($varFile, '(?:\"\>)(.*)(?:\<\/a>)', 3)
If @error Then MsgBox (0, "", @error)
_ArrayDisplay ($sRegExp)

For $x = 1 To UBound($sRegExp)-1
    MsgBox (0, "", $sRegExp[$x])
Next

FileDelete ($varOutput)

Just visiting the thread again because I am going to do a complete rewrite of the script. Thanks! I like how it needs no includes (array.au3 is only for arraydisplay)

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...