File operation

zhaozj2021-02-16  83

Made a news release, write some file operation functions, record them here

<% 'Generates a new file and writes to Function CreateNewFile (ByVal FileName) Set afile = fso.Createtextfile (FileName, true) afile.writeline filecontentafile.closeset afile = nothing End Function' reads the template file contents Function GetLyrics () Dim TextStreamDim SDim File Set TextStream = fSO.OpenTextFile (FolderPath & tempfilename, 1) S = TextStream.ReadAll & NewLine & NewLineTextStream.Close GetLyrics = SEnd Function 'read the contents Function ReadFileContent (filename) Dim TextStreamDim SDim File Set TextStream a page = FSO .OpenTextFile (FolderPath & filename, 1) S = TextStream.ReadAll & NewLine & NewLineTextStream.Close ReadFileContent = SEnd Function 'detects whether a file exists' assumed to have been established fsoFunction CheckFileExists (FilePath) if fso.FileExists (FilePath) thenCheckFileExists = trueelseCheckFileExists = falseend ifEnd Function 'delete a file' hypothesis has been established fsoFunction DeleteFile (FilePath) if CheckFileExists (FilePath) thenSet f = fso.GetFile (FilePath) f.Deleteset f = nothingDeleteFile = true 'file was deleted successfully elseDeleteFile = false' file does not exist End ifEnd Function 'Remove all of the product All Dolinoths Function DeleteonePromsg (Byval Pageur l) DIM TEMPARTEMPAR = Split (PageURL, "|") for i = 1 to Ubound (Tempar) Deletefile ((FolderPath & Tempar (i))) 'Delete All Information Page Next End Function' Update One Product Description 'In fact, Into FUNCTION Updatefile (FilePath) Dim Fset F = fso.opentextfile (FilePath, 2, True) F.Write NewContentf.closset f = Nothingend Function%>

转载请注明原文地址:https://www.9cbs.com/read-14192.html

New Post(0)