<pre style="text-indent: 0;" class="brush: vb"><%
' 从文件完整路径中解析文件名
Public Function ParseName(ByRef sFullPath)
Dim re, sFileName, oMatches
Set re = Server.CreateObject("VBScript.RegExp")
re.Pattern = "[^\\]*{1}quot;
Set oMatches = re.Execute(sFullPath)
If oMatches.Count > 0 Then
sFileName = oMatches(0)
Else
sFileName = ""
End If
Set oMatches = Nothing
Set re = Nothing
ParseName = sFileName
End Function
' 从文件完整路径中去掉文件名
Public Function ParsePath(ByRef sFullPath)
Dim re, sFilePath, oMatches
Set re = Server.CreateObject("VBScript.RegExp")
re.Pattern = "^.*\\(?=[^\\]*$)"
Set oMatches = re.Execute(sFullPath)
If oMatches.Count > 0 Then
sFilePath = oMatches(0)
Else
sFilePath = ""
End If
Set oMatches = Nothing
Set re = Nothing
ParsePath = sFilePath
End Function
%>