BloombergLP::bdls::FilesystemUtil::rollFileChain

Roll the file chain at path so that path becomes path.1.

Synopsis

Declared in <bdls_filesystemutil.h>

static
int
rollFileChain(
    std::string_view const& path,
    int maxSuffix);

Description

Remove the file at the specified path appended with the specified maxSuffix using a . as a separator. Then move the files with the suffixes .1 to .maxSuffix-1 so they have new suffixes from .2 to .maxSuffix. Finally, move path to path with a .1 suffix. Return 0 on success, and non-zero otherwise.

Return Value

0 on success, and a non-zero value otherwise

Parameters

NameDescription
pathfilesystem path of the file to roll
maxSuffixhighest numeric suffix in the file chain