String Handling for File Operations

By | 2019-04-06

This is a module containing twenty useful functions for working with files, directories, drives, and volumes.

Notice

This content originally appeared on on extreme-vb.net. Permission from Bob Schwarz has been granted to included it here for archival purposes.

We can’t reach the future without a bridge to the past.

The below table contains a list of the functions, along with a brief explanation of what each one does.

Function NameDescriptionInputOutput
FindExecutableFinds the executable associated with a filestringstring
ShellDeleteDeletes a single file, or an array of files to the recycle binvariant arrayboolean
ShellWaitShell command and wait for completionstringboolean
ExecuteWaitExecutes a function and waits for completionstringboolean
AddBackslashAdds a backslash if the string doesn’t have one alreadystringstring
ExecuteExecutes a file with it’s associated programinteger, stringboolean
GetFileReturns the file portion of a file + pathnamestringstring
GetPathReturns the path portion of a file + pathnamestringstring
GetSerialNumberReturns a volume’s serial numberStringLong
GetShortPathNamereturn the short path for a path + filestringstring
GetVolumeNamereturns the volume name of a given disk volumestringstring
SetVolumeNameSets the volume name. Returns true on success, false on failurestringsboolean
GetSystemDirectoryReturns the system directoryStringString
GetTempFileNameReturns a unique tempfile name string
GetTempPathReturns the path to the temp directory String
GetWindowsDirectoryReturns the windows directory String
RemoveBackslashRemoves the backslash from the string if it has oneStringString
sDriveTypeReturns the drive type if possibleStringString
GetDriveTypereturns the drive type, via APIStringLong
FileExistsDetermines whether the specified file existsStringInteger

Attachments

FileUploadedSize
389-20190406-090953-basfile.zip4/6/2019 9:09:53 AM3704
Author: dwirch

Derek Wirch is a seasoned IT professional with an impressive career dating back to 1986. He brings a wealth of knowledge and hands-on experience that is invaluable to those embarking on their journey in the tech industry.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.