FilesGetNextFileName Method

Returns path if a file with specified name does not exist yet. Otherwise, returns the first non-existing file name with a number postfix.

Definition

Namespace: KGySoft.CoreLibraries
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 8.0.0
C#
public static string? GetNextFileName(
	string path,
	string? postfixSeparator = null
)

Parameters

path  String
Full path of the file to check.
postfixSeparator  String  (Optional)
A postfix between the file name and the numbering. This parameter is optional.
Default value: .

Return Value

String
Returns path, if that is a non-existing file name. Returns , if path denotes a root directory. Otherwise, returns a non-existing file name with a number postfix in the file name part (the extension will not be changed).

Exceptions

See Also