InStrRev("abcd.jpg", ".") 计算出abcd.jpg中第一次出现.所在的位置是第几个字符=5
mid("abcd.jpg",1,4) 取前四位abcd
mid("abcd.jpg",5) 从五位往后取(包括第五位) .jpg
取前缀abc
FullPath = "abc.jpg"
f = mid(FullPath,1,InStrRev(FullPath, ".")-1)
Response.Write f
娶后缀jpg
FullPath = "abc.jpg"
f = mid(FullPath,InStrRev(FullPath, ".")+1)
Response.Write f
<%
Set MyFileObject=Server.CreateObject("Scripting.FileSystemObject")‘创建一个Folder对象
foldername=server.mappath("./")
Set MyFolder=MyFileObject.GetFolder(foldername)
i=0‘循环显示其中文件夹
response.write "显示文件夹:"
For Each thing in MyFolder.subfolders
Response.Write("<br>"&thing)
i=i+1
Next
response.write "<br>共有"&i&"个文件夹"
response.write "<p>显示文件名"‘循环显示其中文件
i=0
For Each thing in MyFolder.Files
Response.Write("<br>"&thing)
i=i+1
Next
response.write "<br>共有"&i&"个文件"
%>
时间: 2024-10-12 04:44:59