<%
'##########################
'文件处理函数集
'张胜永windxixi编制
'使用此函数集非常方便
'
'
'
'#########################
'########################
Function CreatePath(sPath)
'生成指定目录结构
'########################
Dim fso
Dim pos
Dim aTmp
Dim sNewpath
Dim n
Set fso=Server.CreateObject("Scripting.FileSystemObject")
pos=Instr(3,sPath,"/",1)
aTmp=Split(Mid(sPath,pos+1),"/")
sNewPath=Left(sPath,pos-1)
For n = 0 to Ubound(aTmp)
sNewPath = sNewPath & "/" & aTmp(n)
If NOT fso.FolderExists(sNewPath) then fso.CreateFolder(sNewPath)
Next
CreatePath=(Err=0)
End Function
'############################
Sub WriteFile(Filstr,Filename)
'写入文件
'############################
Dim File,FSO
Set FSO=Server.CreateObject("Scripting.FileSystemObject")
Set File=FSO.CreateTextFile(Filename,True)
File.WriteLine(Filstr)
File.Close
Set FSO=nothing
End Sub
'############################################
Function MakeFile(Filstr,Filename)
'make txt files over on 03.03.09 6:10PM
'建立目录并写入内容
'############################################
dim filenamet
filenamet=left(filename,instrRev(filename,"/"))
createpath(filenamet)
WriteFile Filstr,Filename
End Function
'################################################
Function Del(f)
'Kill the Folder or File over on 03/03/09 6:29PM
'################################################
dim FSO,i,tArr
Set FSO=Server.CreateObject("Scripting.FileSystemObject")
tArr=Split(f,", ")
For i=0 to Ubound(tArr)
tArr(i)=Replace(tArr(i),"`",",")
If Right(tArr(i),1)="/" Then ' Dir
tArr(i)=Left(tArr(i),Len(tArr(i))-1) ' Remove trailing "/"
fso.deleteFolder tArr(i), true
Else 'file
fso.deleteFile tArr(i),true
End If
Next
End Function
'###########################################################################################
function makefilename()
'make a name of files it is use the news format.if a news add the name is enter
'##########################################################################################
fname = now()
fname = replace(fname,"-","")
fname = replace(fname," ","")
fname = replace(fname,":","")
fname = replace(fname,"PM","")
fname = replace(fname,"AM","")
fname = replace(fname,"上午","")
fname = replace(fname,"下午","")
makefilename=fname&".htm"
end function
'#################################获取扩展名################################################################
function getFileExtName(fileName)
dim pos
pos=instrrev(filename,".")
if pos>0 then
getFileExtName=mid(fileName,pos+1)
else
getFileExtName=""
end if
end function
%>
'##########################
'文件处理函数集
'张胜永windxixi编制
'使用此函数集非常方便
'
'
'
'#########################
'########################
Function CreatePath(sPath)
'生成指定目录结构
'########################
Dim fso
Dim pos
Dim aTmp
Dim sNewpath
Dim n
Set fso=Server.CreateObject("Scripting.FileSystemObject")
pos=Instr(3,sPath,"/",1)
aTmp=Split(Mid(sPath,pos+1),"/")
sNewPath=Left(sPath,pos-1)
For n = 0 to Ubound(aTmp)
sNewPath = sNewPath & "/" & aTmp(n)
If NOT fso.FolderExists(sNewPath) then fso.CreateFolder(sNewPath)
Next
CreatePath=(Err=0)
End Function
'############################
Sub WriteFile(Filstr,Filename)
'写入文件
'############################
Dim File,FSO
Set FSO=Server.CreateObject("Scripting.FileSystemObject")
Set File=FSO.CreateTextFile(Filename,True)
File.WriteLine(Filstr)
File.Close
Set FSO=nothing
End Sub
'############################################
Function MakeFile(Filstr,Filename)
'make txt files over on 03.03.09 6:10PM
'建立目录并写入内容
'############################################
dim filenamet
filenamet=left(filename,instrRev(filename,"/"))
createpath(filenamet)
WriteFile Filstr,Filename
End Function
'################################################
Function Del(f)
'Kill the Folder or File over on 03/03/09 6:29PM
'################################################
dim FSO,i,tArr
Set FSO=Server.CreateObject("Scripting.FileSystemObject")
tArr=Split(f,", ")
For i=0 to Ubound(tArr)
tArr(i)=Replace(tArr(i),"`",",")
If Right(tArr(i),1)="/" Then ' Dir
tArr(i)=Left(tArr(i),Len(tArr(i))-1) ' Remove trailing "/"
fso.deleteFolder tArr(i), true
Else 'file
fso.deleteFile tArr(i),true
End If
Next
End Function
'###########################################################################################
function makefilename()
'make a name of files it is use the news format.if a news add the name is enter
'##########################################################################################
fname = now()
fname = replace(fname,"-","")
fname = replace(fname," ","")
fname = replace(fname,":","")
fname = replace(fname,"PM","")
fname = replace(fname,"AM","")
fname = replace(fname,"上午","")
fname = replace(fname,"下午","")
makefilename=fname&".htm"
end function
'#################################获取扩展名################################################################
function getFileExtName(fileName)
dim pos
pos=instrrev(filename,".")
if pos>0 then
getFileExtName=mid(fileName,pos+1)
else
getFileExtName=""
end if
end function
%>