FSO means FileSystemObject, which is a file system object. The FSO object model is included in the Scripting type library (), which also includes five objects: Drive, Folder, File, FileSystemObject and TextStream, which is very convenient to operate files and folders.
FSO file (File) object properties
Attribute Description
DateCreated Returns the date and time of creation of this folder
DateLastAccessed Returns the date and time of the last access to the file
DateLastModified Returns the date and time of the last modified file
Drive Returns the Drive object of the drive where the file resides
Name Set or return the name of the file
ParentFolder Returns the Folder object of the parent folder of the file
Path returns the absolute path to the file, and can use a long file name
ShortName returns the file name in DOS style 8.3 form
ShortPath returns the absolute path of the file in DOS style 8.3 form
Size Returns the size (bytes) of the file
Type If possible, return a file type description string
FSO file (File) object method
FSO file object method Use
CopyFile Copy one or more files to the new path
CreateTextFile Creates a file and returns a TextStream object
DeleteFile Delete a file
OpenTextFile Opens the file and returns the TextStream object for reading or appending
Rename the file:
dim oFso,oFile
set oFso=("")
set oFile=((sourceName))
=destName
Set oFso=Nothing
Set oFile=Nothing
End Function
Delete the file
dim fso,f
set fso = ("")
f=(fileName)
if (f) then
f,true
end if
set f = nothing
set fso = nothing
End Function
Replace strings in file
Dim objFSO,objCountFile,FiletempData
Set objFSO = ("")
Set objCountFile = ((fileName),1,True)
FiletempData =
FiletempData=Replace(FiletempData,Target,repString)
Set objCountFile=((fileName),True)
FiletempData
Set objCountFile=Nothing
Set objFSO = Nothing
End Function