I’ve always had problems with folders that start with ‘The,’ as it places the folder under ‘t’ when arranged in alphabetical order.  I’m really big into using file directories for my media, and as the computers at my work use scripts for all kinds of redundant operations, I it would be a good challenge to make one of my own.  This is pretty simple; I’ll get more in-depth with scripting as I go.

Create a new text file, copy the code into the file, and rename it to .vbs  Don’t forget to change the directories and string fields to suit your needs.  I’m not too big on VB, so I modified another script to get me started, but the search and replace functions are specific to our job (rearranging ‘the’ in the folder name).

Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFolder = oFSO.GetFolder("z:\Movies")
RenameSubFolders(oFolder)
set oFolder = Nothing
set oFSO = Nothing


Function RenameSubFolders(myFolder)

For each oSubFolder in myFolder.SubFolders
dim pos
pos=InStr(oSubFolder.Name,"The ")
If pos = 1 Then
oSubFolder.Name = Mid(oSubFolder.Name, 5) + ", The"
RenameSubFolders(oSubFolder)
End If
Next

End Function

This script searches for a string in a folder name and places it at the end of the said folder name.  So, for instance, I have a ton of folders named “The (MovieName)”  This script renames them to “(MovieName), The”.  Like I said, I’m old school and use file directories for everything (no I-Tunes, thank you) so alphabetical order is very important.  Rather than taking the hours to rename a bunch of folders, I took an hour to toy around with some Visual Basic.  Totally worth it.

So in the end, I really don’t understand why people don’t use scripts more often, especially for the growing media libraries that most people have on their computers.  I guess it all comes down to I-Tunes and similar applications.