The Notebook Review forums were hosted by TechTarget, who shut down them down on January 31, 2022. This static read-only archive was pulled by NBR forum users between January 20 and January 31, 2022, in an effort to make sure that the valuable technical information that had been posted on the forums is preserved. For current discussions, many NBR forum users moved over to NotebookTalk.net after the shutdown.
Problems? See this thread at archive.org.

    anyway to automate the process of creating a lot of folders?

    Discussion in 'Windows OS and Software' started by kenny1999, Mar 13, 2017.

  1. kenny1999

    kenny1999 Notebook Evangelist

    Reputations:
    26
    Messages:
    359
    Likes Received:
    28
    Trophy Points:
    41
    suppose there are a lot of files in a directory with the naming structure like

    kenny_001.jpg
    kenny_002.jpg
    kenny_003.jpg
    ....

    tommy_001.jpg
    tommy_002.jpg
    tommy_003.jpg
    ....

    mary_001.jpg
    mary_002.jpg
    mary_003.jpg


    ..

    ...


    ...

    And I have to create separate folders for files starting with kenny, mary, and tommy
    like so that they are arranged in a better way

    without creating kenny , mary and tommy's folder one by one, because I don't get three folder only. I actually get 3000 or more e.g. kenny, mary, tommy, louis, peter, jerry..... up to 3000 names. and I don't want to create 3000 folders it will take many hassle

    Any way to automate the process of creating the folders and moving the corresponding files into corresponding folders?? i.e.g all files starting with name kenny will be moved to kenny's folder and that of mary will be moved to mary's folder
     
  2. Jarhead

    Jarhead 恋の♡アカサタナ

    Reputations:
    5,036
    Messages:
    12,168
    Likes Received:
    3,132
    Trophy Points:
    681
    Sure, you could write a small script to do the work for you. An example pseudocode:

    Code:
    For each file:
    Get the name substring from file name (Kenny, etc) by taking characters from the first to the last one before "_".
    If that folder doesn't exist, create it.
    Copy file from current folder to new folder
    
     
    Last edited: Mar 14, 2017
    HTWingNut likes this.
  3. kenny1999

    kenny1999 Notebook Evangelist

    Reputations:
    26
    Messages:
    359
    Likes Received:
    28
    Trophy Points:
    41
    I have zero knowledge of writing codes or scripts
     
  4. Jarhead

    Jarhead 恋の♡アカサタナ

    Reputations:
    5,036
    Messages:
    12,168
    Likes Received:
    3,132
    Trophy Points:
    681
    Ah, well I don't know of any off-the-shelf programs to do this, and it's a really short piece of code. Now is just as good a time as any ;).
     
  5. alexhawker

    alexhawker Spent Gladiator

    Reputations:
    500
    Messages:
    2,540
    Likes Received:
    792
    Trophy Points:
    131