I need a quick VB6 function to return a unique file name in a directory. The parameters would be:
Beginning file name
Directory (full path)
Maximum filename length
This function will return a unique file name for the given directory that I can create without duplicating an existing file name. It will use as much as it can from the beginning file name parameter. The maximum filename length should default to 50. The filename length does NOT include the extension. For example, a maximum file length of 8 would allow a file name with 8 characters plus an extension.
The beginning filename should be used as a base. For instance, if the calling routine passes "[url removed, login to view]" as the beginning file name with a maximum length of 8, the routine would use as much of the beginning filename as possible. If the directory already contains a file named [url removed, login to view], the routine would try [url removed, login to view], [url removed, login to view], [url removed, login to view], etc. until it found a file name that is unique to the directory. If it uses up all the options, then it should return an empty string. It can recurse if necessary but preferably not because I don't want to use up a lot of stack space with this one function.
I need this as soon as possible. Need to finish a project and don't have time to write this routine. Need it today so I'll accept the first legit bid with a $ amount at $15 or under.
1) Complete and fully-functional working function in module form as well as complete source code of all work done.
2) Exclusive and complete copyrights to all work purchased. (No GPL, 3rd party components, etc. unless all copyright ramifications are explained AND AGREED TO by the buyer on the site).