Notifications
Clear all

[Closed] How to download multiple files from a web server

Is it possible to download all files in a folder that exist in web server?
For example:
1- I have
http://miauu.com/files/xml/

2- in http://miauu.com/files/xml/ i have
http://miauu.com/files/xml/text_01.xml
http://miauu.com/files/xml/text_02.xml
http://miauu.com/files/xml/text_03.xml
http://miauu.com/files/xml/text_04.xml
http://miauu.com/files/xml/text_05.xml

3- can I download ll files(text_01.xml to text_05.xml)?

For now I use this:

( dotNetObject "System.Net.WebClient" ).downloadFile  http://miauu.com/files/xml/text_02.xml  ( getDir #temp + "\	ext_02.xml" )

but this allows me to download only one file, which name I know.

6 Replies

Thank you.
I know nothing about c# and can’t find a way to convert this to maxscript, or to be used in a script.

(
  	url = "http://www.ibiblio.org/pub/";
  	request = (DotNetClass "System.Net.WebRequest").Create(url);
  	response = request.GetResponse();
  	reader = DotNetObject "System.IO.StreamReader"  (response.GetResponseStream());
  	html = reader.ReadToEnd();
  	regex = DotNetObject "System.Text.RegularExpressions.Regex" "<a href=\".*\">(?<name>.*)</a>"
  	matches = regex.Matches html;
  	for i = 0 to matches.count - 1 do print matches.Item[i].Groups.Item["name"].value;
  )	

obviously you’ll need to add some error checking and tailor the regex expression to your own particular html format.

Thank you.

http://www.regexr.com/

I just found this really useful site for doing Regex writing.

nice toy! thanks.