This is still a few individual can not show, turned the next MSDN seemingly did not see a better solution, to give up the continuation of research, there are know completely solve friends may wish to reply to say.
First attach bat to create a malformed directory, the following code copy is saved as A.bat:
Copy Code code as follows:
MD aux\\
MD com1\\
MD com2\\
MD prn\\
MD con\\
MD nul\\
MD dot...\\
MD Onedot. \\
Program code
Copy Code code as follows:
<% @LANGUAGE = "VBSCRIPT" codepage= "65001"%>
<%
Option Explicit
Response.Charset = "UTF-8"
Session.CodePage = 65001
Session.Timeout = 1440
Server.ScriptTimeout = 9999
'***************************
' Name: Directory List class
' Author: Yi product
' Date: 2010-4-28
' URL: www.jb51.net
' Description: Directory list class, support for malformed directory names
'***************************
Class Fsocls
Private Fso
Public Fsoobj
Private Sub Class_Initialize
Set fso=createobject ("Scripting.FileSystemObject")
Set Fsoobj=fso
End Sub
Private Sub Class_Terminate
Set fso=nothing
Set fsoobj=nothing
End Sub
Function isfolderexists (FolderPath)
If FSO. FolderExists (FolderPath) Then
Isfolderexists = True
Else
Isfolderexists = False
End If
End Function
Function FolderItem (ByVal folderdir)
If Instr (Folderdir, ": \") >0 Then
Folderdir= "\\?\" &FolderDir& "\"
Else
Folderdir= "\\?\" &server.mappath (folderdir) & "\"
End If
If isfolderexists (folderdir) = False Then
Folderitem=false
Exit Function
End If
Dim Folderobj,folderlist,f,i
I=1
Set Folderobj=fso.getfolder (Folderdir)
Set folderlist=folderobj.subfolders
folderitem= "Total directory:" &FolderObj.SubFolders.Count& "folderitem=folderitem& "Total Files:" &FolderObj.Files.count& "
For each F in Folderlist
' Response.Write F.shortname
' Response.Write (InStr (1,f.shortname, "~", 1))
If isfolderexists (folderdir&f.name) = True Then Response.Write ("t<br>" & vbCrLf)
If (InStr (1,f.name, ".", 0) >0) Then
Response.Write ("T")
F.name=replace (F.name, ".", "-")
End If
folderitem=folderitem&i& "├─ folder →" &F.Name& "<br>" & vbCrLf
I=i+1
Next
Set folderlist=nothing
Set folderobj=nothing
End Function
End Class
%>
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<title> Directory list classes support malformed directory names </title>
<body>
<%
Dim F:set F = new Fsocls
Response.Write F.folderitem ("/")
%>
</body>