Navigation:  Scripting > System Scripts >

System Script File Utility Functions

Previous pageReturn to chapter overviewNext page

vbld_FSO(): creates and returns a new FileSystemObject for manipulating and retrieving properties of files and folders.  Some common uses for this object:

 

Script expressionPurpose
[vbld_FSO.FolderExists("%SAMPLEDB%")]Determine if a folder exists (returns -1 if found or 0 if not)
[vbld_FSO.FileExists("c:\autoexec.bat")]Determine if a file exists (returns -1 if found or 0 if not)
[vbld_FSO.GetFileVersion("c:\pathto\file.ext")]Returns the file version of the specified file

 

For more information, see the documentation for the FileSystemObject.

 

vbld_CompareFileDates(TargetFile, SourceFile): Provides a simple 'make' capability to compare a source and target file.  Compares the date/timestamp of two files and return -1 if the target file does not exist or is older than the source file, 0 if they are equal, or 1 if the target file is newer than the source file.

 

vbld_CopyFile(SourceFile, DestFile, Overwrite): Copies a file. Note: The Copy Files action provides more robust file copy capabilities.

 

vbld_FileDateModified(FileSpec): Returns the modification date of a file.

 

vbld_FileOutOfDate(TargetFile, SourceFile): Compares files by version info if available or size+timestamp if not if the target file does not exist, returns True; otherwise if the files contain version information, the version info is compared and True is returned if the target file's version is older; if no version info is available, the files are compared by timestamp of last modification, returning True if the target file is older; if the timestamps match, a file size comparison is also performed and True returned if target file is older than the source file.

 

vbld_GetFileContents(Filename): Retrieve the contents of a file and double up characters that are treated specially by Visual Build.  Bracket characters [ ] and percent sign % characters are normally interpreted by Visual Build as referencing script code and macros within a field.  When retrieving the contents of a file into a field, using this function will cause these characters to be treated as literals by Visual Build. Note: The Read File action can also retrieve the contents of a file.

 

vbld_MakeFileWriteable(Filename): ensure that a file is writeable and return True if found and succeeded. Note: The Set File Attributes action can also be used to make a file writeable (or set other attributes).