This code uses a FileSystemObject To find the File Base Name, File Extension, File Name, The Parent
This code uses a FileSystemObject To find the File Base Name, File Extension, File Name, The Parent Folder, The 3 Special Folders and a
Rate This code uses a FileSystemObject To find the File Base Name, File Extension, File Name, The Parent
(1(1 Vote))
Call GetFileStuff("c:\autoexec.bat") ' whatever!
End Sub
Sub GetFileStuff(FilePath)
Dim Fso, BaseName, Extension, FileName, Path
Set Fso = CreateObject("Scripting.FileSystemObject") 'Create the file system object, DUH!
'filesystem stuff
BaseName = Fso.getbasename(FilePath) ' Gets the filename whitout the path and Extension!
Extension = Fso.GetExtensionName(FilePath) ' Gets the file Extension!
FileName = Fso.getfilename(FilePath) ' Gets the long Filename whit the Extension
Path = Fso.GetParentFolderName(FilePath) ' the folder the file isin
Text1.Text = "Basename: " & BaseName & " Extension: " & Extension & " FileName: " & FileName & " Folder: " & Path
'Other Filesystem stuff
For i = 0 To 2 'this lists all the SpecialFolders: WindowsFolder, SystemFolder, TemporaryFolder in a list box
Dim SF
SF = Fso.GetSpecialFolder(i)
List1.AddItem SF 'adds the Special folder to a list
Next
Dim tempfile
tempfile = Fso.GetTempName 'Returns a randomly generated temporary file or folder name that is useful for performing operations that require a temporary file or folder.
End Sub
This code uses a FileSystemObject To find the File Base Name, File Extension, File Name, The Parent Comments
No comments yet — be the first to post one!
Post a Comment