www.gusucode.com > 新锐领秀网络相册 1.1 > include/fso.asp
<% '---------------------------------------------------- ' [Gong] (C)2007-2008 . ' This is NOT a freeware, use is subject to license terms ' Id: fso.asp 2008-03-26 00:53:29 Gong '---------------------------------------------------- Function gLoadFile(FilePath) Dim temp,content Dim objFSO Set objFSO = Server.CreateObject(gFSO) Set temp=objFSO.OpenTextFile(FilePath) content=temp.ReadAll temp.close Set temp=Nothing Set objFSO=Nothing gLoadFile=content End Function Function gGetFilePath(FullPath,str) If FullPath <> "" Then gGetFilePath = left(FullPath,InStrRev(FullPath, str)-1) Else gGetFilePath = "" End If End Function Function gFileExists(FilePath) Dim objFSO Set objFSO = Server.CreateObject(gFSO) If True = objFSO.fileExists(FilePath) Then gFileExists=True Else gFileExists=False End If Set objFSO = Nothing End Function Function gCreatetFile(saveFileName,Content)'创建文件,同名覆盖 Dim temp,objFSO Set objFSO = Server.CreateObject(gFSO) Set temp=objFSO.CreateTextFile(saveFileName,True) temp.WriteLine(Content) temp.close If True = IsObject(temp) Then gCreatetFile = True Else gCreatetFile = False End If Set temp=Nothing Set objFSO=Nothing End Function Function gDeleteFile(FilePath)'删除文件 Dim objFSO Set objFSO = Server.CreateObject(gFSO) If objFSO.FileExists(FilePath) Then objFSO.DeleteFile(FilePath) gDeleteFile = True Else gDeleteFile = False End If Set objFSO = Nothing End Function Function gDeleteFolder(FolderPath)'删除一个文件夹 Dim objFSO Set objFSO = Server.CreateObject(gFSO) If objFSO.FolderExists(FolderName) Then objFSO.DeleteFolder(FolderName) gDeleteFolder = True Else gDeleteFolder = False End If Set objFSO = Nothing End Function Function gCreateFolder(FolderName)'创建一个文件夹 Dim objFSO Set objFSO = Server.CreateObject(gFSO) If not(objFSO.FolderExists(FolderName)) Then objFSO.CreateFolder(FolderName) gCreateFolder = True Else gCreateFolder = False End If Set objFSO = Nothing End Function Function gCreateDateFolders(Folders,lPath)'按照系统生成文件夹2006/03/06 Dim arr_F,i,temp,flag temp="" Folders=Replace(Folders,"\","/") arr_F=Split(Folders,"/") For i=0 To UBound(arr_F) temp=temp&"/"&arr_F(i) flag = gCreateFolder(gGetFilePath(lPath,"\")&temp) Next gCreateDateFolders = flag End Function %>