Here is what I came up with for creating a drop down with all folders and sub-folders (directories) but is there a way that I can use a similar script to view all files AND folders on a remote server WHERE it supports directory listings (Apache server with no default page, so it shows the directories and files).
function dirsize($dir=".") {
$sizes=array();
$dirs=array();
$handle=opendir($dir);
while($file=readdir($handle))
$retVal[]=$file;
closedir($handle);
sort($retVal);
foreach($retVal as $k=>$v)
{
if($v!="." && $v!="..") {
$count ++ ;
if(is_dir("$dir/$v")) {
$dirs[$count] = ("$dir/$v");
dirsize("$dir/$v");
}
}
}
foreach ( $dirs as $k=>$vv ) {
// print "$vv<br>";
$vvv = substr($vv,2)."/";
echo "<option value=\"$vvv\">$vvv</option>";
}
}
[/color]
I run Sambar on WinXP so Apache is a different world for me.
I want to be able to, I suppose, crawl a specified directory of a remote server that supports this (no FTP here for sure), just be able to crawl the directories and "array" the files/folders so that a user could click "GO" and transfer them all in one recursive shot. Using somthing like:
$data=file_get_contents("$remote_file");
$rfilesize = filesize($temp);
if ($rfilesize < 51200 ) {
$fp=fopen("$local_file","wb");
fputs($fp,$data,strlen($data));
fclose($fp);
.... where I would loop until all files are fput into the specified directory on my server
I guess I just don't know how to make a script out of this that allows me to crawl the remote server and specified folder. That is it in a nut shell
Also, I am new to PHPBuilder forum, is this the correct place for a post such as this? thank you so much for the help to get me to this point to all.