Creating a File Explorer
page 2 of 5
by . .
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 30031/ 40

FileSystemObject

FileSystemObject

The core of this application is the FileSystemObject (FSO) object. The FSO contains all the tools needed for browsing directories, accessing files, editing files etc. This article isn't an introduction to the FSO.

The folder view

The folder's pane has to do several things -

  • List folder names with links to the folders.

  • Have the ability to view files in those folders (through the files frame).

  • Be able to create new folders.

  • Be able to modify folders.

  • Show general information about the folders.

  • Show the 'Up one level...' if it is not a root folder.

  • Show all other drives on the computer.

<%
If Len(Request.QueryString("drive")) Then
set objDrive = objFSO.GetDrive(Request.QueryString("drive"))
Else
set objDrive = objFSO.GetDrive("d:")
End If

Dim colFolder
Dim objcolFolders
If Len(Request.QueryString("folder")) Then
set objcolFolders = objFSO.GetFolder(Request.QueryString("folder"))
set colFolder = objColFolders.SubFolders
Else
Set objcolFolders = objFSO.GetFolder(objDrive.Driveletter & ":\domains")
set colFolder = objcolFolders.subfolders
End If
%>

This code attained the drive and folder that you wanted to access, this meant that you could just change two properties (1 if you inputted the whole path) to show the entire listing. It also specified default values.

<%
Dim objParent
If Not objcolFolders.Path = objDrive.Driveletter & ":\domains" Then
Set objParent = objcolFolders.ParentFolder
Response.Write("<a href=folders.asp?folder=" & objParent.Path & " target=folders>..Up one level</a>")
End If
%>

<%
Dim objSubFoldas
Dim objsubfoldas2
For each folda in colFolder
Response.Write("Edited listing")
Next
%>

These two block incorporate the ...Up one level and the entire listing (I edited that because it was too long).

 <%
For intCode = 65 To 90
letter = Chr(intCode)
If objFSO.DriveExists(letter) Then
Response.Write("<option value=" & letter & ">" & letter & "</option>")
End If
Next
%>

This looped through all of the drive letters possible (A (65)  - Z (90)) and checked for their existence before showing the option to display them.

The 'View' link, was set to link to files.asp?folder=[current folder].

The New Folder and 'More...' links were set to a file called morefolders.asp. On that page are a list of actions that the user can perform.


View Entire Article

User Comments

No comments posted yet.

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-04-25 3:55:26 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search