Home / Lua Scripts Libraries API Manual / dtutils.file / filename_increment
< file_move
get_basename >

# 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.

< file_move
get_basename >