The last couple of weeks I’ve been doing a lot of reorganizing of some of my media files. Part of this reorg has been shifting files around and consolidating folders. One challenge I ran into was having files with conflicting names. Since I don’t want to accidentally override any files, I created this helper function to test if a file name already exists. If it does detect a conflict, it will keep appending a number until it finds an available name.
The Good Stuff: Use Get-AvailableFileName to help find a name that’s not already in use.