file.uniqueName

Syntax file.uniqueName (prefix, folder, places, extension)

Params prefix is a string that's used in constructing the unique name.

folder is the path on disk to the folder the file is to be stored in.

places is the number of numeric characters to use when building the unique name. If not specified, the default is 3.

extension is the file extension, if any, including the dot. If not specified, the default is no extension.

Action Creates a file name, based on prefix and places, that is not already in use in folder.

Returns The path on disk to a file that doesn't already exist, and is safe to create.

Examples file.uniqueName ("myfile", "Power HD:archives:")

   » "Power HD:archives:myfile001"

file.uniqueName ("myfile", "Power HD:archives:", 6)

   » "Power HD:archives:myfile000001"

file.uniqueName ("myfile", "Power HD:archives:", 2, ".html")

   » "Power HD:archives:myfile01.html"

Notes It's the caller's responsibility to ensure that the created file name won't be longer than the limit for the current operating system.

This script does not create any files: it's up to the caller to actually create the file.

See Also table.uniqueName

Discuss