• Creating sequentially numbered folders

    Home » Forums » AskWoody support » Windows » Windows – other » Creating sequentially numbered folders

    Author
    Topic
    #487731

    I am going on a photographic holiday. At the end of each day, I would like to come back to my hotel room and download the days pictures to a folder on the hard drivel I want to know if there is a simple and/or easy way to create a number of folders that are numbered/dated sequentially? For example, I would like folders ordered like this:

    February 16
    February 17
    February 18
    .
    .
    .
    Last Folder, e.g., February 28.

    etc. This way, I could have a file structure that I can use to store and backup my image files each day. This folder sequence would be created beforehand so I don’t have to worry about it on my holiday.

    I know that I can do this by creating each file manually, but I am curious to know if it is possible to do this in a way that is faster than creating each folder, one at a time. I compare this to what you can do in Excel when you need to show a sequence of row numbers and you want to be able to number a whole bunch of them at one time. Any thoughts or insight into whether or not this is possible? Thanks.

    Ron M

    Viewing 7 reply threads
    Author
    Replies
    • #1374379

      Assuming your OS is some fairly recent version of Windows…
      you’re welcome to try this script. The real scripting fun would start if your holiday extends into March.

      Code:
      ' make_folders
      '
      ' Open this script in Notepad.
      ' Define the first 4 variables to suit yourself.
      ' Save the script as make_folders.vbs
      ' Run the script.
      '
      ' Adapted from a script by heyscriptingguy.
      
      
      intStart = 16
      intEnd = 18
      strParentFolder = "C:UsersRonPictures2013"
      strStem = "February "
      
      Set objFSO = CreateObject("Scripting.FileSystemObject")
      If Right(strParentFolder, 1)  "" Then
      	strParentFolder = strParentFolder & ""
      End If
      If Not objFSO.FolderExists(strParentFolder) Then
      	MsgBox "Can't find parent folder", vbOKOnly + vbCritical, Wscript.ScriptName
      ElseIf intStart < 0 Or intEnd  31 Then
      	MsgBox "Number out of range", vbOKOnly + vbCritical, Wscript.ScriptName
      Else
      	For i = intStart to intEnd
      		strNumber = i
      		strNumber = Right("0" & strNumber, 2)
      		strFolder = strParentFolder & strStem & strNumber
      		If Not objFSO.FolderExists(strFolder) Then
      			Set objFolder = objFSO.CreateFolder(strFolder)
      		End If
      	Next
      End If
      
      • #1376253

        I saw your code example and I think I understand it. But how do I execute this code?

        Thanks,

        Hyp-Nautic

      • #1562336

        This is awesome. Thanks for sharing. My requirements are a little different, so I added my changes to what you provided. See below.

        Assuming your OS is some fairly recent version of Windows…
        you’re welcome to try this script. The real scripting fun would start if your holiday extends into March.

        Code:
        ' make_folders
        '
        ' Open this script in Notepad.
        ' Define the first 4 variables to suit yourself.
        ' Save the script as make_folders.vbs
        ' Run the script.
        '
        ' Adapted from a script by heyscriptingguy.
        
        
        intStart = 18
        intEnd = 101
        strParentFolder = "C:UsersmeDesktoptest"
        strStem = "func-0"
        strEnd = "-comp-class-"
        
        Set objFSO = CreateObject("Scripting.FileSystemObject")
        If Right(strParentFolder, 1)  "" Then
            strParentFolder = strParentFolder & ""
        End If
        If Not objFSO.FolderExists(strParentFolder) Then
            MsgBox "Can't find parent folder", vbOKOnly + vbCritical, Wscript.ScriptName
        ElseIf intStart < 0 Or intEnd  101 Then
            MsgBox "Number out of range", vbOKOnly + vbCritical, Wscript.ScriptName
        Else
            For i = intStart to intEnd
                strNumber = i
                strNumber = Right("0" & strNumber, 2)
                strFolder = strParentFolder & strStem & strNumber & strEnd
                If Not objFSO.FolderExists(strFolder) Then
                    Set objFolder = objFSO.CreateFolder(strFolder)
                End If
            Next
        End If
        
        • #1562342

          This is awesome. Thanks for sharing. My requirements are a little different, so I added my changes to what you provided. See below.

          Thanks for checking in.

          Because 3-digit numbers are possible in your script, you need to do something with this line:
          strNumber = Right(“0” & strNumber, 2)
          It pads numbers with zeros if necessary, to make all numbers 2-digit so that the folder names sort properly (…08, 09, 10, 11, 12…). It will also, unfortunately for you, truncate 3-digit numbers.

          If you don’t care about sort order and uniform length of names, just delete the line. If you do, try this:
          strNumber = Right(“00” & strNumber, 3)

    • #1374443

      Also it depends on what OS you’re using. In XP you have to use the ALT F W F keys (just keep holding alt down and sequence through the other keys repeatedly) to create each new folder rapid fire (30 seconds perhaps 20 folders created). Then highlight all the new folders at once (and you’ll already see where this is going by that point) and rename the first folder February (16) and enter…all the rest of the folder will be named February and increase the integer in each subsequent folder by one.
      The beauty of this method is you can roll right into March or anytime of the year just by renaming the folder set again from February (29) on to March (01).

      Works the same for 7 and 8 I think except you create the new folders by holding the Ctrl and Shift keys down and alternate between the n key and Enter.

      • #1376086

        @F.U.N. downtown

        Win 7 works like you described for XP — very slick. (Ctrl-n opens a new window in the same folder in Win 7.)

    • #1374455

      I use Picasa (it’s free) to manage my pictures and download them from my camera. It automatically names the folders from the date info on the camera. It even names the folders correctly so they sort – YYYY-MM-DD.

      cheers, Paul

      • #1375318

        iTobaman,thanks for the Script. Not being a real techie guy anymore, I will give it a try, but I was really hoping that there was something one could do from a menu – oh well, can’t have everything – 🙂

        F.U.N. Downtown, I am using Win 7 Home edition. I am afraid that I do not understand the approach that you have outlined.

        Paul, thanks for the suggestion, but I really do not want to “manage” my images while I am on vacation – you understand, I hope. I simply want to have a file structure that I can use to store each days results. I will eventually load everything into Lightroom when I get home and manage it all there. Because, I have never used it, I am not sure if Picasa will handle my camera’s raw format.

        Ron M

    • #1375336

      I would just use Picasa as well, you can use as much or, as little of the management part as you wish.

      Since you are using Win 7 I can make it even easier for you to try my technique. Go to or create whatever folder you are planning on placing the numbered folders in. Then in the Organize line you will see New Folder. Click on that followed by the Enter key, then New Folder again, followed by Enter and so on. You will see new folders pop up in that folder that get numbered successively with each new folder.

      When you have a sufficient number of new folders created, drag and select ALL the new folders so they are all highlighted. Then right click on the first new folder and choose to Rename. Change the name of the first folder (with all the rest still highlighted) to February (16) or whatever starting date you want and press enter. The rest of the new folders will also be renamed automatically, with an increase in the number in parenthesis by one with each folder. In other words the second folder will get named February (17) and the third will be February (18) and so on; so you can use the number in parenthesis as your date.

      • #1375979

        This is a very cool technique. Thanks for sharing this! 🙂

        Do you know any tricks for building a monthly set, as if 01 January, 02 February, 03 March, etc.? Right now, I have a “master set” of blank folders for when I want to start a new year of photo archives and I just copy those.

        These seem like such basic folder management activities that I can’t believe MS hasn’t built these in long ago.

        I would just use Picasa as well, you can use as much or, as little of the management part as you wish.

        Since you are using Win 7 I can make it even easier for you to try my technique. Go to or create whatever folder you are planning on placing the numbered folders in. Then in the Organize line you will see New Folder. Click on that followed by the Enter key, then New Folder again, followed by Enter and so on. You will see new folders pop up in that folder that get numbered successively with each new folder.

        When you have a sufficient number of new folders created, drag and select ALL the new folders so they are all highlighted. Then right click on the first new folder and choose to Rename. Change the name of the first folder (with all the rest still highlighted) to February (16) or whatever starting date you want and press enter. The rest of the new folders will also be renamed automatically, with an increase in the number in parenthesis by one with each folder. In other words the second folder will get named February (17) and the third will be February (18) and so on; so you can use the number in parenthesis as your date.

    • #1375441

      It’s a one-line command-line script, assuming you have started a Command Prompt window and changed into the directory in which you want to create the February folders:
      for /l %a in (16,1,28) do md “February %a”

      BATcher

      Plethora means a lot to me.

    • #1375504

      Picasa supports RAW format from most cameras.
      http://support.google.com/picasa/answer/15625?hl=en&ref_topic=1689793

      cheers, Paul

    • #1376005

      I think you could just add the number to the front of the name exactly as you outlined, any number of creative naming schemes would keep them in line based on month, sub sorted based on parenthetical number.

    • #1376045

      I use what I think to be a usable method. I create only one folder for each year, the name of the folder being the year number, such as 2013. I rename each photo as follows: first digit is the month 1, 2, 3, … 9, A, B, C. the next two digits are the day of the month. next the underscore _ followed by the camera assigned sequence number followed by the name of the person(s) in the photo. This makes it very easy to view and find photos using a browser such as windows explorer, Irfanview, etc. When I have several photos taken on the same day, I use the Bulk Rename Utility. Irfanview makes it really easy to rename each photo by using the F2 key.

      While this may seem to be a bit of work I think it worth the time as I can find photos very easily and quickly. I got the month-day idea from an Olympus camera which automatically affixed the month and day.

    Viewing 7 reply threads
    Reply To: Creating sequentially numbered folders

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: