I need to convert many Actor images in my IBN>People folder into one folder of individual jpg files. Does anyone have a script that could do this? The jpg file name would need to be converted from “folder” back to the Actors name.
I have some ID Passport software that can bulk process images. It uses facial recognition and will put the face into a 2:3 aspect ratio…the size used by MB Actor images. I can then use File2Folder to put that back into folder.
I’ve just modified a version of another script I had – give this a go, but please try it on a copy of your People folder just in case something goes wrong (there’s no money back guarantee).
Take the code below and save it as “Folder2Files.vbs”, then using explorer drag and drop your people folder on top of the script file.
Note: it moves the images up a level, and if it’s original folder is now empty it will delete the folder. If there’s any folders left over, they probably contain other images or thumbnails.
function Folder2Files(SourceFolder, destination) Set objFSO = CreateObject("Scripting.FileSystemObject") Set sf = objFSO.GetFolder(SourceFolder) Set fc = sf.SubFolders For Each subFolder in fc Set fs = objFSO.GetFolder(subFolder).Files For Each thisFile in fs if thisFile.name = "Thumbs.db" then objFSO.DeleteFile(thisFile) elseif LCase(thisFile.name) = "folder.jpg" then thisFile.name = subFolder.name & ".jpg" objFSO.MoveFile thisFile, destination & "\" elseif LCase(thisFile.name) = "folder.png" then thisFile.name = subFolder.name & ".png" objFSO.MoveFile thisFile, destination & "\" end if Next if subFolder.files.count = 0 And subFolder.SubFolders.Count = 0 then objFSO.DeleteFolder(subFolder) end if Next End Function dest = WScript.Arguments.Item(0) a = Folder2Files(dest, dest)
That is just slicker than shit!!! Works great sir. It saved me a couple massive nasty steps. So far I only tried it on different groups of test folders. I wonder how much it can bench press? I suspect I can’t drag/drop 30,000 Actor folders on top of it. I can break them down into small sub groups. I will check in with you later with more details. I truly appreciate the help…for sure.
I was processing about 20,000 Folders and ran into error messages. If the image file inside the folders are a bizarre format the script will stop and post an error message (Line 9, Character 11). You have to find where the script stopped and remove those bad folders.
Here are some file prefix’s I ran into that stopped the script. Instead of being named “folder” they were the following:
I’m not sure where these file names came from. They might have been some of the Actor folders in the IBN People Project database I downloaded. Thank you sir.