getUniqueFilename {utilitiesR}R Documentation

Generates a unique file name by incrementing a counter.

Description

Generates a unique file name by incrementing a counter.

Usage

  getUniqueFilename(fPath, overwrite = FALSE)

Arguments

fPath

file path to make unique

overwrite

boolean, default FALSE, whether to generate a file name that is the name of an already-existing file, i.e. *don't* make the filename unique.

Value

unique file name, consisting of the original with a number appended (filename1.txt, filename2.txt, etc).

See Also

Other file: createFilename, dir.browse, file.browse, getExtension, getFilename, makeIfNotExists

Examples

getUniqueFilename('foo.txt')
 # if foo.txt exists, returns 'foo1.txt'
 # if foo1.txt exists, returns 'foo2.txt'. etc.

[Package utilitiesR version 1.6.2 Index]