The files in one of our servers can be accessed via http. So, when we bring up a url similar to the following, we get a list of files/directories in that location:
No, you'll need to do some parsing of the returned HTML.
Given this page as an example: http://central.maven.org/maven2/com/bloidonia/groovy-stream/
We'd need to do something like:
@Grab( 'org.ccil.cowan.tagsoup:tagsoup:1.2.1' )
def url = 'http://central.maven.org/maven2/com/bloidonia/groovy-stream/'.toURL()
new XmlSlurper( new org.ccil.cowan.tagsoup.Parser() ).parseText( url.text )
.body
.pre
.a
.each { link ->
if( link.@href.text().endsWith( '/' ) ) {
println "FOLDER : ${link.text()}"
}
else {
println "FILE : ${link.text()}"
}
}
Which prints out:
FOLDER : ../
FOLDER : 0.5.1/
FOLDER : 0.5.2/
FOLDER : 0.5.3/
FOLDER : 0.5.4/
FOLDER : 0.6/
FOLDER : 0.6.1/
FOLDER : 0.6.2/
FILE : maven-metadata.xml
FILE : maven-metadata.xml.md5
FILE : maven-metadata.xml.sha1
Obviously, you'd need to tweak the body.pre.a
bit to match the output of your webserver for directory listings