Skip to content
wpferguson edited this page Jun 14, 2020 · 1 revision

FILENAME_INCREMENT

NAME

filename_increment

SYNOPSIS

add a two digit increment to a filename

USAGE

local df = require "lib/dtutils.file"
local result = df.filename_increment(filepath)

filepath - string - filename to increment

DESCRIPTION

filename_increment solves the problem of filename conflict by adding an increment to the filename. If the supplied filename has no increment then "01" is added to the basename. If the filename already has an increment, then 1 is added to it and the filename returned.

RETURN VALUE

result - string - the incremented filename

LIMITATIONS

The filename will be incremented to a maximum of 99.

Clone this wiki locally