|
GetDirectories - Returns all the subdirectories of a directory
|
Total Hit (3293) |
«Code LangId=1»' Returns a collection holding all the subdirectories in a path
' that match search attributes (optionally it returns the entire path).
Function GetDirectories(path As String, Optional Attributes As VbFileAttribute, _
Optional IncludePath As Boolean) As Collection
Dim d
....Read More |
Rating
|
|
|
|
|
GetFilebaseName - Retrieve the base portion in a file name
|
Total Hit (1628) |
«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 (2076) |
«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 (5045) |
«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 (5243) |
«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 (3898) |
«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 (1706) |
«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 (2260) |
«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 (4317) |
«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 (2822) |
«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 (1479) |
«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 (1670) |
«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 (2216) |
«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 (1856) |
«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 (1890) |
«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 (3517) |
«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 (1668) |
«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 (2717) |
«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
|
|
|
|
GetAllFiles - Search files in a directory or directory tree
|
Total Hit (4719) |
«code LangId=1»Private Sub Command1_Click()
Dim col As Collection
'//Get all files from C:\ (No sub folder) which are older than 5 days and newer than 30 days
Set col = GetAllFiles("c:\", "*.*", False, 30, 5)
For Each f In col
Debug.Print FileDateTime(f) & "=>" & f
....Read More |
Rating
|
|
|
|
GetAttrDescr - The attributes of a file in a readable format
|
Total Hit (2676) |
«Code LangId=1»
' The attributes of a file in a readable format.
' It works also with open files, raises an error if the file doesn't exist.
Function GetAttrDescr(filename As String) As String
Dim result As String, attr As Long
' get file attributes as a bit-coded field
attr =
....Read More |
Rating
|
|