|
|
GetFilebaseName - Retrieve the base portion in a file name
|
Total Hit (1579) |
«Code LangId=1»' Retrieve a file's base name
' if the second argument is true, the result include the file's path
Function GetFileBaseName(FileName As String, Optional ByVal IncludePath As _
Boolean) As String
Dim i As Long, startPos As Long, endPos As Long
startPos = 1
....Read More |
Rating
|
|
|
|
|
|
GetFileExtension - The extension in a filename
|
Total Hit (2026) |
«Code LangId=1»' Return the extension of a file name
Function GetFileExtension(ByVal FileName As String) As String
Dim i As Long
For i = Len(FileName) To 1 Step -1
Select Case Mid$(FileName, i, 1)
Case "."
GetFileExtension = Mid$(FileName, i + 1)
....Read More |
Rating
|
|
|
GetFileIcon - Retrieve the icon associated to a file
|
Total Hit (4955) |
«Code LangId=1»Private Const MAX_PATH = 260
Private Type SHFILEINFO
hIcon As Long
iIcon As Long
dwAttributes As Long
szDisplayName As String * MAX_PATH
szTypeName As String * 80
End Type
Private Declare Function SHGetFileInfo Lib "Shell32" Alias "SHGetFileInfoA" _
....Read More |
Rating
|
|
|
GetFileOwner - Get the owner of an NTFS file
|
Total Hit (5163) |
«Code LangId=1»Private Declare Function GetFileSecurity Lib "advapi32.dll" Alias _
"GetFileSecurityA" (ByVal lpFileName As String, ByVal RequestedInformation _
As Long, pSecurityDescriptor As Byte, ByVal nLength As Long, _
lpnLengthNeeded As Long) As Long
Private Declare Function Ge
....Read More |
Rating
|
|
|
GetFilePath - Extract the path portion of a file name
|
Total Hit (3811) |
«Code LangId=1»
' Retrieve a file's path
'
' Note: trailing backslashes are never included in the result
Function GetFilePath(FileName As String) As String
Dim i As Long
For i = Len(FileName) To 1 Step -1
Select Case Mid$(FileName, i, 1)
Case ":"
....Read More |
Rating
|
|
|
GetFiles - Returns all the files in a directory
|
Total Hit (1662) |
«Code LangId=1»' Returns a collection holding all the filenames that
' match a given filespec and search attributes.
Function GetFiles(filespec As String, Optional Attributes As VbFileAttribute) _
As Collection
Dim filename As String
Set GetFiles = New Collection
....Read More |
Rating
|
|
|
|
GetFileVersionData - Retrieve file versioning information
|
Total Hit (2198) |
«Code LangId=1»Private Declare Function GetFileVersionInfoSize Lib "version.dll" Alias _
"GetFileVersionInfoSizeA" (ByVal lptstrFilename As String, _
lpdwHandle As Long) As Long
Private Declare Function GetFileVersionInfo Lib "version.dll" Alias _
"GetFileVersionInfoA" (ByVal lptstr
....Read More |
Rating
|
|
|
|
GetShortFileName - Convert a filename to 8.3 format
|
Total Hit (4226) |
«Code LangId=1»
Private Declare Function GetShortPathName Lib "kernel32" Alias _
"GetShortPathNameA" (ByVal lpszLongPath As String, _
ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long
' Convert a long filename into the short 8.3 format
' if the file doesn't exist, retur
....Read More |
Rating
|
|
|
GetTempFile - Create a temporary file
|
Total Hit (2751) |
«Code LangId=1»
Private Declare Function GetTempFileName Lib "Kernel32" Alias _
"GetTempFileNameA" (ByVal lpszPath As String, _
ByVal lpPrefixString As String, ByVal wUnique As Long, _
ByVal lpTempFileName As String) As Long
Private Declare Function GetTempPath Lib "Kernel32" Alias
....Read More |
Rating
|
|
|
IsExecFile - Check whether a file is an executable file
|
Total Hit (1424) |
«Code LangId=1»'check whether the specified file is an executable,
' by checking the last 4 characters.
'Example: MsgBox "File is exe: " & IsExecFile("C:\windows\notepad.exe")
Function IsExecFile(ByVal sFileName As String) As Boolean
Dim sExt As String
On Error Resume Next
....Read More |
Rating
|
|
|
ListFiles - List all the files in a directory or directory tree
|
Total Hit (1617) |
«Code LangId=1»
' list all the files in a directory
' if NESTEDDIRS = True it lists a whole directory tree
'
' returns a 1-based array containing all the listed files
Function ListFiles(ByVal Path As String, Optional ByVal NestedDirs As Boolean) _
As String()
Dim fso As New Scripti
....Read More |
Rating
|
|
|
LongPathName - Convert a 8.3 file name to long format
|
Total Hit (2154) |
«Code LangId=1»Private Declare Function GetLongPathName Lib "kernel32" Alias _
"GetLongPathNameA" (ByVal lpszShortPath As String, _
ByVal lpszLongPath As String, ByVal cchBuffer As Long) As Long
Const MAX_PATH = 260
' Convert a short file/path name to a long name
' the file or path
....Read More |
Rating
|
|
|
|
MakeFileName - Create a file name out of its parts
|
Total Hit (1798) |
«Code LangId=1»
' Make a complete file name by assemblying its individual parts
' if Extension isn't omitted, it overwrites any extension held in BaseName
Function MakeFileName(Drive As String, Path As String, BaseName As String, _
Optional Extension As String)
' add a trailing col
....Read More |
Rating
|
|
|
MakePath - Create a nested directory
|
Total Hit (1830) |
«Code LangId=1»' create a nested directory
'
' it's similar to MkDir, but it also creates
' all intermediary sub-directories
Sub MakePath(ByVal path As String)
Dim i As Integer, ercode As Long
On Error Resume Next
Do
' get the next path chunk
i = InStr(i
....Read More |
Rating
|
|
|
ReadFromStdInput - Read from standard input stream
|
Total Hit (3447) |
«Code LangId=1»Private Declare Function GetStdHandle Lib "kernel32" (ByVal nStdHandle As Long) _
As Long
Private Declare Function ReadFile Lib "kernel32" (ByVal hFile As Long, _
lpBuffer As Any, ByVal nNumberOfBytesToRead As Long, _
lpNumberOfBytesRead As Long, lpOverlapped As Any)
....Read More |
Rating
|
|
|
SearchFileOnPath - Search a file on system path
|
Total Hit (1600) |
«Code LangId=1»
Private Declare Function SearchPath Lib "kernel32" Alias "SearchPathA" (ByVal _
lpPath As String, ByVal lpFileName As String, ByVal lpExtension As String, _
ByVal nBufferLength As Long, ByVal lpBuffer As String, _
ByVal lpFilePart As String) As Long
' Search a fil
....Read More |
Rating
|
|
|
SetFileSize - Trim or extend a file's size
|
Total Hit (2653) |
«Code LangId=1»
Option Explicit
Private Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" (ByVal _
lpFileName As String, ByVal dwDesiredAccess As Long, _
ByVal dwShareMode As Long, lpSecurityAttributes As Any, _
ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAt
....Read More |
Rating
|
|
|
ShortPathName - Convert a long file name to 8.3 format
|
Total Hit (3217) |
«Code LangId=1»Private Declare Function GetShortPathName Lib "kernel32" Alias _
"GetShortPathNameA" (ByVal lpszLongPath As String, _
ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long
Const MAX_PATH = 260
' Convert a long file/path name to a short 8.3 name
' the path m
....Read More |
Rating
|
|
|
|
|
SystemDirectory - The path of the System directory
|
Total Hit (1799) |
«Code LangId=1»
Private Declare Function GetSystemDirectory Lib "kernel32" Alias _
"GetSystemDirectoryA" (ByVal lpBuffer As String, _
ByVal nSize As Long) As Long
' The path of the System directory
Function SystemDirectory() As String
Dim buffer As String * 512, length As Int
....Read More |
Rating
|
|
|
VolumeLabel - Read the label of a disk volume
|
Total Hit (1694) |
«Code LangId=1»' Return the volume label of a disk
' Pass a null string for the current disk
Function VolumeLabel(drive As String) As String
Dim temp As String
On Error Resume Next
temp = Dir$(drive, vbVolume)
' remove the period after the eigth character
VolumeLabel =
....Read More |
Rating
|
|
|
WindowsDirectory - The path of the Windows directory
|
Total Hit (1922) |
«Code LangId=1»Private Declare Function GetWindowsDirectory Lib "kernel32" Alias _
"GetWindowsDirectoryA" (ByVal lpBuffer As String, _
ByVal nSize As Long) As Long
' Return the path of the Windows directory
Function WindowsDirectory() As String
Dim buffer As String * 512, lengt
....Read More |
Rating
|
|