[RESOLVED] Auto-increment file name when renaming collision occurs
Windows File Explorer has a feature when renaming a file where if the new file name is already taken by a file in the same folder, a new name of this form is suggested: "filename (1).ext". If a file with this name is already in use as well, the name "filename (2).ext" is suggested, etc...
I have coded my own version of this functionality but I'm wondering if there's an API which exposes this functionality?
Re: Auto-increment file name when renaming collision occurs
Welp, I just needed to search a little longer...
Here's a post by Bonnie West which seems to address my question:
http://www.vbforums.com/showthread.p...=1#post5007755
In it she discusses two Shell32 APIs which do this:
PathMakeUniqueName
https://docs.microsoft.com/en-us/win...makeuniquename
PathYetAnotherMakeUniqueName
https://docs.microsoft.com/en-us/win...makeuniquename
I just need to study these to see what the differences are and which is right for my needs.
Re: [RESOLVED] Auto-increment file name when renaming collision occurs
I've gotten PathMakeUniqueName to work and the output is what I'm looking for. However, being a Shell32 API, file paths are limited to MAX_PATH in length. So I guess I'm sticking with my own solution.