Topic Path: Symbol Reference > Functions > GetUniqueFileName Function
ContentsIndexHome
PreviousUpNext
GetUniqueFileName Function

Generates a unique file name with the specified path, prefix, and file extension.

File
function GetUniqueFileName(
    const APath: String; 
    const APrefix: String; 
    const AExt: String
): String;
Parameters 
Description 
APath 
Path for the generated file name.
 
APrefix 
File name prefix for the generated file name.
 
AExt 
File extension for the generated file name. 

String - Unique file name including the path, prefix, and extension specified.

GetUniqueFileName is a String function used to generate a unique file name that incorporates the values specified in the APath, APrefix, and AExt parameters. GetUniqueFileName returns a value that includes the specified values, and the hexidecimal representation of the value from the Ticks function. For example: 

 

   c:pathprefix_FFFCB26A.ext

 

APath is an optional path to include in the unique file name. When APath contains a non-empty string value, GetUniqueFileName ensures that a trailing path delimiter exists in the APath argument. When APath contains an empty string (''), the file name will refer to a file in the current directory. 

APrefix is an optional value to be prepended to the unique file name, or an empty string ('') when no file name prefix is desired. 

AExt is an optional extension for the unique file name, or an empty string when no file name extension is desired. When AExt contains a non-empty string, GetUniqueFileName ensures that a '.' character exists in the value for AExt. 

GetUniqueFileName will execute until the return value contains a file name that does not already exist.

Copyright 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.