GetFindFileAttributes

GetFindFileAttributes retrieves the file Attributes of the currently matched file after a successful call to either FindFirstFile or FindNextFile methods.

When FindFileClose is called, GetFindFileName, GetFindFileSize and GetFindFileAttributes should not be used since this will make the Scripting engine fail.

Syntax

GetFindFileAttributes

Returns

File attributes of currently matched file. These are the attributes from dwFileAttributes member in WIN32 defined structure WIN32_FIND_DATA. Bit masks are defined as FILE_ATTRUTE_* constants. I.e. FILE_ATTRUTE_DIRECTORY is defined as 0x10.

Bit Masks Definition
FILE_ATTRIBUTE_READONLY

&H1

FILE_ATTRIBUTE_HIDDEN

&H2

FILE_ATTRIBUTE_SYSTEM

&H4

FILE_ATTRIBUTE_DIRECTORY

&H10

FILE_ATTRIBUTE_ARCHIVE

&H20

FILE_ATTRIBUTE_DEVICE

&H40

FILE_ATTRIBUTE_NORMAL

&H80

FILE_ATTRIBUTE_TEMPORARY

&H100

FILE_ATTRIBUTE_SPARSE_FILE

&H200

FILE_ATTRIBUTE_REPARSE_POINT

&H400

FILE_ATTRIBUTE_COMPRESSED

&H800

FILE_ATTRIBUTE_OFFLINE

&H1000

FILE_ATTRIBUTE_NOT_CONTENT_INDEXED

&H2000

FILE_ATTRIBUTE_ENCRYPTED

&H4000

Example

An example of RenameFile function in the FTPA protocol used to transfer files between network computers. Object. Renames all files found in the root of the FTP server:

Function Main

Dim FTPobj as Object

Const DIRECTORYMASK=&H10

ip = "127.0.0.1"

port = 21

Set FTPobj = FTP.Connect (ip,port,TRUE,"anonymous","lnss@gfi.com")

Found=FTPobj.FindFirstFile("*")

While Found

If (FTPobj.GetFindFileAttributes And DIRECTORYMASK) = DIRECTORYMASK Then

FileType="directory"

Else

FileType="file"

End If

echo "File: " + FTPobj.GetFindFileName + " size: " + CStr(FTPobj.GetFindFileSize) + " bytes type: " + FileType

Found=FTPobj.FindNextFile

Wend

End Function