I’ve run into this problem several times and I’ve never found a complete solution until now. We use a lot of pictures at work and I should probably come up with a more modern way of managing them, but I’m stuck in my ways and I use a relatively archane way of organizing the photos. Each folder name is in yyyy-mm-dd-desc format. I use Picasa and through it’s search function combined with my folder-naming scheme, I can usually find what I’m looking for without too much trouble. So, in conclusion, if it’s not broken, don’t fix it.
But, something does ‘break’ every once in a while and it has occasionally prevented me from renaming the subfolders where I store my pictures. I’ll copy the folder from the camera’s SD card to the server and then go to change the folder name and Windows tells me that the folder is being used by another program and can’t be renamed. The old solution was to just sit and wait it out…normally a couple of minutes but very frustrating. Today, I think I finally won this battle.
First step was to confirm what I thought was going on. I found this page and tried the unlock tool, but it didn’t work; it didn’t find anything that was locking my folder and I was still unable to rename it. I then used procexp which I’ve used in the past and like a lot for certain things. Procexp allowed me to confirm that it was explorer.exe locking the thumbs.db file. This file is the thumbnail database that windows creates for any folder that contains images. So, now that I had confirmation that the thumbs.db was causing the problem, I could implement a permanent solution.
It took a two fold approach.
- Prevent windows from creating thumbs.db files. I found this page here that instructed me how to add a registry entry to prevent creation of thumbs.db files.
At this point, I thought I had won. I rebooted, went to my pictures directory, looked at some pictures in a subdirectory to see what an appropriate name would be, went to rename and, bam, same thing; windows wouldn’t let me rename the folder. I concluded that since the thumbs.db file was still there, it was still being updated every time I opened the folder and hence why I still couldn’t rename the folder.
- Delete all the thumbs.db files recursively in my Pictures directory.
With step 1, I had solved the problem of Windows creating new thumbs.db files, but now I had to deal with all the existing thumbs.db files that were still causing me problems. This went fine, I just had to find the correct switches for delete when used from the command line. Windows won’t let you delete thumbs.db from windows explorer nor would it be very practical to go into every pictures subdirectory and delete them all (it’s a hidden file and since windows locks thumbs.db when you’re in that directory, you can’t easily delete it, if at all, through the GUI). So, it was off to the command prompt which I ran as administrator since I was going to be deleting hidden files. Then in the root of my Pictures directory, I executed the following command
del thumbs.db /S /A:H. What this command does is deletes the file thumbs.db recursively (that is in each subdirectory) and since it’s a hidden file, I’m pretty sure that you have to specify to delete files with the hidden attribute. A note of warning: using del recursively can be dangerous and delete files unintentionally; please use caution with this command.
So, in conclusion, if you’re having trouble with renaming folders that contains the windows hidden file, thumbs.db, the above solution should work. I had read lots of solutions to this problem, but none ever worked for me 100%. I’m pretty sure this is due to my relatively unique situation of dealing with folders that always contained images and the hidden thumbs.db file.