.







Cenk Yurtseven
 
English Deutsch Türkçe
Home ASP Scripts ASP Scripts File Management File Management

 
File And Folder Scanner File And Folder Scanner Dili:  ASP 
Scans a folder for all sub-folders and files.

File And Folder Scanner

<%@LANGUAGE="JavaScript" %>
<%
function ScanFolders(objPath, iLevel)
{
var objFolderInfo = objFSO.GetFolder(objPath);
var objFileList = new Enumerator(objFolderInfo.Files);
var strIndent = "";
for(var i = 0; i < iLevel; i++)
{
strIndent += " ";
}
Response.Write(strIndent + "<BLOCKQUOTE> ");
while (!objFileList.atEnd())
{
var strFileName = objFileList.item().Name;
//if(strFileName.indexOf(".mdb") != -1) /*looks for mdb files only*/
//{
Response.Write(strIndent + " " + objFileList.item().Name + "<BR> ");
//}
// or in a short way
//Response.Write(strFileName.indexOf(".mdb") != -1 ? strIndent + " " + objFileList.item().Name + "<BR> " : "");
objFileList.moveNext();
}
Response.Write(strIndent + "</BLOCKQUOTE> ");
var objSubFolder = new Enumerator(objFolderInfo.SubFolders);
while(!objSubFolder.atEnd())
{
var thisSubFolder = objSubFolder.item();
Response.Write(strIndent + "<BLOCKQUOTE> ");
Response.Write(strIndent + " <B>" + thisSubFolder.Name + "</B> ");
iLevel++;
ScanFolders(thisSubFolder, iLevel);
iLevel--;
Response.Write(strIndent + "</BLOCKQUOTE> ");
objSubFolder.moveNext();
}
}
var strPath = Server.MapPath(".");
%>
<!
DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<
HTML>
<
HEAD>
<
META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1254">
<
TITLE>File and Folder Scanner</TITLE>
<
STYLE TYPE="text/css">
BODY, TD, FORM {
font-family : MS Sans Serif;
font-size : 8pt;
}
</
STYLE>
</
HEAD>
<
BODY>
<%
Response.Write("<B>" + strPath + "</B><BR> ");
var objFSO = new ActiveXObject("Scripting.FileSystemObject");
ScanFolders(strPath, 0);
objFSO = null;
%>
</
BODY>
</
HTML>


Member Login  |  Kontakt