Link to home
Create AccountLog in
Avatar of mtthompsons

asked on

Vb script to create 1 folder with name "Posters" in all folders in specified path

Vb script to create 1 folder with name "Posters" in all folders in specified path

I need help with a script that can can check every folder in this path


Create 1 folder called "Posters" in every subdirectory available. I have


Within this i have 10 folders and within those 10 i have 1000+ in each

Need to create 1 folder each in all those 1000+ folders in each of those 10 folders

Avatar of kulboy

Set FSO = CreateObject("Scripting.FileSystemObject")
ShowSubfolders FSO.GetFolder("C:\Scripts"), 3

Sub ShowSubFolders(Folder, Depth)
    If Depth > 0 then
        For Each Subfolder in Folder.SubFolders
            Wscript.Echo Subfolder.Path
              ' do your folder creation stuff here...
            ShowSubFolders Subfolder, Depth -1
    End if
End Sub

you can set the folder depth in the parameter (here 3 for the example)
Avatar of mtthompsons



If i change to 3 just in the 3rd folder depth it will create a folder called "Posters"?
the script i gave you will do the itteration of the folders,  you will still need to create the folder itself.

look at where i say to do the folder creation magic

you could use something like this:

If Not FSO.FolderExists(newfolderpath) Then
Set newfolder = FSO.CreateFolder(newfolderpath)
Avatar of Bill Prew
Bill Prew

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account