troubleshooting Question

Display local folder content (sub folders & files (not hidden)) using JavaScript

Avatar of creativepresence
creativepresence asked on
Web Languages and Standards
3 Comments1 Solution342 ViewsLast Modified:
Guys, slowly getting a solution that works for me via here, but still not completely there.  I work on a helpdesk and want to create a webpage that will display a htm/html page showing the content of multiple networked folders, such as

VAR: Folder path
Folder 1
Folder 2
Doc 1
Doc 2
Doc 7

VAR: another folder path
Folder 1
Folder 2
Doc 1
Doc 2
Doc 7

with the folder and document links clickable to open in a new page.  Someone on here has helped part way, but only to display the content (files) of one folder.

This is what I have so far...

<script src="scripts/filelist.js"></script>
<BODY topmargin="0" leftmargin="0" onLoad="Scan()">
<input size=50 type=text value="c:\" id=path name=path class="Field" >
<div id=outPut_c></div>


var Fo =new ActiveXObject("Scripting.FileSystemObject");
var StrOut = new String();
var FileName = new String();
var Extention = new String();
var FilePath = new String();

function FindFile(FOo)
	var FSo = new Enumerator(FOo.Files);
		if(FileName == "*" ||  FSo.item().name.slice(0,FSo.item().name.lastIndexOf(".")).toLowerCase().indexOf(FileName)>-1)
			if(Extention == "*" || FSo.item().name.slice(FSo.item().name.lastIndexOf(".")+1).toLowerCase().indexOf(Extention)>-1){
			if (FSo.item().Attributes & 2 ){}
				StrOut += "<tr "+ ((i%2)? "":"bgcolor=#FFFFFF")  +"><td width=50%><font class=find>" + '<a href="file:///'+FSo.item().name+'">'+FSo.item().name + "</a></font></td><td width=25%><font class=find>" + FSo.item().type + "</font></td><td width=50%><font class=find>"+ String(FSo.item().size/(1024*1024)).slice(0,3) +" MB</font></td></tr>";

function Scan()
	if(path.value.length>0 && Fo.FolderExists(path.value)){
		StrOut = "<table border=0 width=100% cellspacing=0>"
		outPut_c.innerHTML = StrOut+"</table>";
	else alert("Insert Correct Path Address");

Is it possible to call multiple folder contents and display in a webpage as it would seem the
will only overwrite the existing display.
Bernard Savonet

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros