[Closed] get array of files on a srv ?
hi i wanted to ask if there is a way to get an array of the files contained on a server.
atm im going a bigger way round by collecting the files into a string in php then …WebClient”).downloadString to get that string and then i split it apart into files wich kinda takes its time with many files so i wanted to know if there was a faster/easier way to do this.
:shrug:
(
if internet.CheckConnection url:"http://Insanto.3d.lc" force:true do
(
local baseAddy = @"http://Insanto.3d.lc/toolsIndex/"
local str = ((dotNetObject "System.Net.WebClient").downloadString (baseAddy+"index.php"))
local arr = for i = 1 to 1000 while matchPattern str pattern:"*@*" ignoreCase:false collect
(
local index = findString str "@"
local a = subString str 1 (index-1)
str = replace str 1 index ""
baseAddy + a
)
for fileAddy in arr do
(
print fileAddy
)
)
)
^^ yeah i know, was using “BREAK” before to seperate them so i had to use this method of seperation
but the seperation on the max side aint the prob, the problem is how to get all files in a folder on a server without any use of aditional php code.
you can use FtpWebRequest Class
http://msdn.microsoft.com/en-us/library/system.net.ftpwebrequest.aspx
oh, thats neat
do you know if you can also use the ssl option with max?
what has max got to do with it? what do you want to do specifically? connect to ftp over ssl? as i remember it was a problem in .net…
not specifically a ftp, it also has a web “frontEnd”
with my current solution ( http://insanto.3d.lc/toolsIndex/ ) i create the filesString dynamically per php from ( http://insanto.3d.lc/toolsIndex/files/ )
<?
function listFilesInDir($start_dir) // folder fileName-array lister
{
$files = array();
$dir = opendir($start_dir);
while(($myfile = readdir($dir)) !== false)
{
if( $myfile != '.' && $myfile != '..' && !is_file($myfile) ) // && !eregi('^Icon',$myfile) )
{
$files[] = $myfile;
}
}
closedir($dir);
sort($files);
return $files;
}
$A ='@';
$slash = '/';
$dir = 'files';
$pics = listFilesInDir($dir);
foreach($pics as $key => $fileName)
{
echo $dir.$slash.$fileName.$A;
}
?>
but this requires a folder and a subFolder and allways the phpCode for every “library”.
what i wish to do is to someHow drop the whole php side and do the whole thing in max,
basically a “getFiles” for the aforementioned onlineDir.
the reason that i want to use ssl when using the FtpWebRequest is that the tool im planning to use this in is going to be freeware and i dont want to give everyone the acc details :hmm: