Question Folders Back2Files anyone?

 
  • Created:over 1 year ago
  • Status:open
  • Related:#8804

Hi All,

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.

Thanks.

 
  • I found a script that renames the file to the folder name. Using search for .jpg in that folder, I can copy the results. Seems to be working unless someone has a better way. – AZMedia over 1 year ago

3 Answers

votes newest oldest
 
  • Created:over 1 year ago
  • Modified:over 1 year ago

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)
 
  • Will do, looks good. Let me clear off my desktop of these 50 different scripts, bats, and test folders..and start over. Stay tuned! Thanks. – AZMedia over 1 year ago
 
  • Created:over 1 year ago

AdrianW,

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.

 
  • Just drag the one top level folder on to it – eg. “People”, it will process all the folders underneath. – AdrianW over 1 year ago
  • I just tried it on a stack of around 700 names, and I noticed some didn’t work. It was due to the casing of the folder.jpg (eg. Folder.jpg) – I’ve altered the script to cater for the variations in casing. – AdrianW over 1 year ago
  • Thank you sir. I didn’t run into that issue. I processed 3,200 with no problem. I am writing up a new thread on how to convert rough images to faces using free tools. I will mention you, this thread, and the new script. I wish I had a place so people could download the Folders2Files script. – AZMedia over 1 year ago
  • Hey, I did run into one issue. It didn’t seem to work when the main folder with Actor subfolders and the bat file were on the Desktop. I had to move everything farther into the Win7 Pictures folder and no problem. – AZMedia over 1 year ago
  • I meant VBS file… – AZMedia over 1 year ago
  • show 1 more comment
 
  • Created:over 1 year ago
  • Modified:over 1 year ago

Hey AdrianW,

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:

folder_alt1
justin-chon
bridgethall040
folder (2)
Folder_
alt1
38673521497b84b9c855o
268368
images
folder.gif
nbnxkftztcwmdu2nzq2mq@@v1sx320_sy400

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.

 
  • Not sure what’s happening there. It’s probably best to just delete those bad files. – AdrianW over 1 year ago