You seem to have an application (iPhoto? iTunes) pointing at your external drive. If the drive isn't mounted, it creates a folder with the same name as the volume. Then when you repeat this, it won't replace that folder, instead it will create another with the name folder 1, folder 2, etc...
Moral of the story, if you are going to use a network or external volume for your libraries, make sure its mounted/connected before you launch any of those apps that rely on it, or hold the option key when you launch them to make sure you are selecting a library that exists.
I do believe iPhoto now asks if the library folder doesn't exist, but can't confirm iTunes or other apps.
Finally, there are several ways to fix this, from writing an Applescript to more fancy "mount as needed" types of configurations.