<-- Previous || Up || Next -->

Increment File Name Function
File Names Class

Public Function IncrementFileName( _
    ByVal vPathName As Variant _
    ) As Variant

Better method for incrementing a file name. Increments the Name portion of the file name by incrementing the number portion at the end of the name.

    IncrementFileName("")                = "1"
    IncrementFileName(".EXE")            = "1.EXE"
    IncrementFileName("A")               = "A1"
    IncrementFileName("FILE.EXE")        = "FILE1.EXE"
    IncrementFileName("PICTURES.TXT")    = "PICTURE1.TXT"
    IncrementFileName("FILE99.EXE")      = "FILE100.EXE"
    IncrementFileName("FILE9999.EXE")    = "FIL10000.EXE"
    IncrementFileName("F14.EXE")         = "F15.EXE"
    IncrementFileName("\\SJS3\F14A.EXE") = "\\SJS3\F14A1.EXE"
    IncrementFileName("C:\TEMP\123.GIF") = "C:\TEMP\124.GIF"
See also:
    IncrementFileNameSimple Function
    IncrementStringWithinCharacterSet Function
    DOSFileNameCharacters Property
vPathName: String containing the file name to be incremented. The file name can contain drive, path (directory), file name and file extension components. Function returns Null if vPathName is Null or cannot be fixed up to a String.
Warning: This function is limited to using DOS-compatible file name characters and DOS-style "8.3" file names in order to retain compatibility with DOS, Windows 3.0, and Windows 3.1.

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.