+ Post New Thread
Results 1 to 5 of 5
Windows 7 Thread, Script to Create folders in folders in Technical; Hi All, I need help creating a Script file to create folders inside of other folders. The specific issue I ...
  1. #1

    Join Date
    Oct 2012
    Location
    Cheshire
    Posts
    3
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Script to Create folders in folders

    Hi All,

    I need help creating a Script file to create folders inside of other folders.

    The specific issue I am having is I need to create Documents and a Photos folder inside of others. I have a list of over 100 usernames, (all with different names but on the same directory). All these folders are empty and I wish to create the two folders inside of the username.

    Having a script like this would save me a great deal of time.

    Can anyone shed some light on this?

    Thanks

  2. #2
    ChrisH's Avatar
    Join Date
    Jun 2005
    Location
    East Lancs
    Posts
    4,943
    Thank Post
    115
    Thanked 272 Times in 250 Posts
    Rep Power
    104
    Just go to the command prompt
    CD to the root of the directory and type:

    Code:
    for /d %i in (*) do mkdir %i\Photos && mkdir %i\Documents
    Simples.

  3. #3

    Join Date
    Oct 2012
    Location
    Cheshire
    Posts
    3
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Brilliant, Would love to know what all the commands mean.

  4. #4
    ChrisH's Avatar
    Join Date
    Jun 2005
    Location
    East Lancs
    Posts
    4,943
    Thank Post
    115
    Thanked 272 Times in 250 Posts
    Rep Power
    104
    Code:
    for /d
    A loop that goes through directories

    Code:
    %i
    This holds the name of the current directory it has found

    Code:
     in (*)
    Use a wildcard for working with multiple directories

    Code:
    mkdir %i\Photos && mkdir %i\Documents
    and finish with 2 make directory command joined together with an and (&&). Every pass the %i is converted to the current folder.

    for /d - Loop through directory | SS64.com

  5. #5

    Join Date
    Oct 2012
    Location
    Cheshire
    Posts
    3
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Very useful information.

    Thanks

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 36
    Last Post: 5th August 2011, 07:13 AM
  2. Replies: 4
    Last Post: 6th October 2010, 09:20 PM
  3. VB Script to create folders
    By markesmith in forum Scripts
    Replies: 2
    Last Post: 26th April 2007, 03:03 PM
  4. Replies: 0
    Last Post: 17th February 2007, 04:43 PM
  5. Script to Create My Documents Subject Folders
    By SwedishChef in forum Scripts
    Replies: 15
    Last Post: 5th July 2006, 08:14 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •