FileInfo

Returns a struct of file information.

Different values are returned for FileInfo and GetFileInfo

Method Signature

FileInfo(file=[any])

Arguments

Argument
Type
Required
Description
Default

file

any

true

The filepath or file object to retrieve info upon

Examples

Output some information about a temporary file

Run Example

myFile = getTempFile( getTempDirectory(), "testFile" );
fileInfo = getFileInfo( myFile );
isReadable = (!fileInfo.CANREAD ? "un" : "") & "readable";
isWritable = (!fileInfo.CANWRITE ? "un" : "") & "writable";
isHidden = (!fileInfo.ISHIDDEN ? "not " : "") & "hidden";
date = DateTimeFormat( fileInfo.LASTMODIFIED, "full" );
fileSize = NumberFormat( fileInfo.SIZE / 1000 / 1000, "0.00" );
writeOutput( """" & fileInfo.NAME & """ is " & isReadable & ", " & isWritable & " and " & isHidden & ". " );
writeOutput( "It was at last modified at " & date & " and has a size of " & fileSize & " MB" );

Result: "testFile9217639658547923751.tmp" is readable, writable and not hidden. It was at last modified at Friday, November 3, 2017 3:58:08 PM UTC and has a size of 0.00 MB

Additional Examples

Run Example

file = getTempFile( getTempDirectory(), "demo" );
dump( var=getFileInfo( file ), label="GetFileInfo" );
dump( var=FileInfo( file ), label="FileInfo" );

Last updated

Was this helpful?