I am trying to write asp pages using vb script to show directory and files on a server so that someone can navigate easily. I know there are simpler and better ways but ASP pages were picked for a reason.
I am getting an error on 'Set Files = Folder.Files' - Any suggestions?
On Error Resume Next
Dim FSO
Dim TestFolder
Dim Folder
Dim FolderText
Dim S
Dim SubFolders
Dim SubFolder
Dim Files
Dim File
TestFolder = "C:\CRS"
Set FSO = CreateObject("Scripting.FileSystemObject")
Folder = FSO.GetFolder(TestFolder)
Set Files = Folder.Files
If Files.Count = 1 Then
S = "There is 1 file"
Else
S = "There are more files"
End If
If Files.Count <> 0 Then
For Each File In Files
S = S & "file - "
Next
End If
Set SubFolders = Folder.SubFolders
If 1 = SubFolders.Count Then
S = S & "There is 1 sub folder"
Else
S = S & "There are " & SubFolders.Count & " sub folders"
End If
Cheers.
Mark.
I am getting an error on 'Set Files = Folder.Files' - Any suggestions?
On Error Resume Next
Dim FSO
Dim TestFolder
Dim Folder
Dim FolderText
Dim S
Dim SubFolders
Dim SubFolder
Dim Files
Dim File
TestFolder = "C:\CRS"
Set FSO = CreateObject("Scripting.FileSystemObject")
Folder = FSO.GetFolder(TestFolder)
Set Files = Folder.Files
If Files.Count = 1 Then
S = "There is 1 file"
Else
S = "There are more files"
End If
If Files.Count <> 0 Then
For Each File In Files
S = S & "file - "
Next
End If
Set SubFolders = Folder.SubFolders
If 1 = SubFolders.Count Then
S = S & "There is 1 sub folder"
Else
S = S & "There are " & SubFolders.Count & " sub folders"
End If
Cheers.
Mark.