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.


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


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

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


See Also