0

i would like to know how to much a bunch of folders with similar names to different folders. e.g (01/15)Mom (01/15)Dad (02/15)Dad (01/15)Brother (03/15)Son So what i want to accomplish is Parent folder (01/15) - sub folders (01/15)Mom, (01/15)Dad and so on and so forth. In other words i want to group by whats in the brackets. So what i want due is generate a date folder to move the pictures folder its matched dated group. Theirs alot of folders so i cant do it manually.

0

Sounds like you may have multiple issues here. Do your photos have meta data?

How are you originally grouping the photos into Mum, Dad etc - forgetting the date for now.

Are they already grouped into their user name? Or are all the files in one directory with just the date of when the file was created in the filename?

You can do searches in Windows (I assume its windows?) and order the photos by date and other meta data like tags etc - these filters are all in the windows search function - depending on how the pics are created you may be able to simply set a filter in search, and move them all in one go.

I do this almost daily with photos, all my family and I take a ton every day and its always me that ends up having to sort and back them all up!

  • ya i could do that jst that there are alot of files and each has a date and location of where they were taken. – eni jing Feb 6 '17 at 6:27
0

In the top level directory create the file sort.vbs and add the following text:

set objFSO = CreateObject("Scripting.FileSystemObject")
set objFolder = objFSO.GetFolder(".")
set colSubfolders = objFolder.Subfolders

strStartChar = "("
strEndChar   = ")"

for each objSubfolder in colSubfolders
    strNameOfFolder = objSubfolder.Name

    if instr(strNameOfFolder, strStartChar) > 0 then

        intStartCharacter = instr(strNameOfFolder,strStartChar) +1
        intEndCharacter   = instr(strNameOfFolder,strEndChar) 
        intLength         = intEndCharacter - intStartCharacter
        strNewFolderName  = mid(strNameOfFolder, intStartCharacter, intLength )

        wscript.echo "Processing: " & strNameOfFolder & ", extracted text for new folder: " & strNewFolderName

        if not objFSO.FolderExists(strNewFolderName) then
            objFSO.CreateFolder strNewFolderName
        end if    

        if objFSO.FolderExists(strNewFolderName) then
            set ExistingFolder = objFSO.GetFolder(strNameOfFolder)
            objFSO.MoveFolder ExistingFolder.name, strNewFolderName & "\"
        end if    

    else
        wscript.echo strNameOfFolder & " not for processing.  No " & strStartChar & " character in directory."
    end if

next

Then open a command prompt in the same directory and run:

cscript.exe sort.vbs.

As you can see it takes the string between the ( and the ) to form the new directory and move the contents of the original directory to it.

Note: There is little error checking and it makes a few assumptions about the directory name.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.