Re: Making folders....

Tech-Archive recommends: Fix windows errors by optimizing your registry



Zadig Galbaras wrote:

Is there a software designed to make a set of subfolders
in a tree of folder?

I mean, I have f eks ten folders named 1 through 10.
Under each there is many subfolders named A through Z

Is there a snappy way to make a set of subfolders to each
of these 260 folders?


Hei Zadig (ikke akkurat et standard norsk navn må jeg si :-)

You can use a VBScript for this. Put the script below in a file with
a .vbs extension, and run it by double clicking on it.

You need to adjust the data in the two variables sBaseFolder and
aNewFolders .


'--------------------8<---------------------- ' Script that will populate a folder structure with a set ' of new folders '


' Define the base folder path ' (the one containing the folders named 1 through 10) sBaseFolder = "C:\some1\some2"

' list all new folders to be created here
aNewFolders = Array("new1", "new2", "new3")

Set oFSO = CreateObject("Scripting.FileSystemObject")

On Error Resume Next
For i = 1 To 10
  For n = Asc("A") To Asc("Z")
    sFolder = sBaseFolder & "\" & i & "\" & Chr(n)
    If oFSO.FolderExists(sFolder) Then
      For Each sNewFolder In aNewFolders
        oFSO.CreateFolder sFolder & "\" & sNewFolder
      Next
    End If
  Next
Next

MsgBox "Finished!", vbInformation + vbSystemModal, "Populate folders"

'--------------------8<----------------------



WSH 5.6 documentation (local help file) can be downloaded from here
if you haven't got it already:
http://msdn.microsoft.com/downloads/list/webdev.asp


-- torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: http://www.microsoft.com/technet/scriptcenter/default.mspx .



Relevant Pages

  • Re: Creating Multiple FTP Users and Containers (2000 Server + IIS)
    ... > IIS Administrator for an FTP site. ... > complete Windows Scripting novice so I'm hoping that I can get some help ... > What I am even more unsure of is scripting the creation of Virtual Folders ... The permissions will need to be set to ...
    (microsoft.public.windows.server.scripting)
  • Re: Newbie Question
    ... administrative tasks is "Microsoft Windows 2000 Scripting Guide". ... Using the FileSystemObject to retrieve information on files and folders is ... figure out the paths to the sub directories. ... Dim intIndex ...
    (microsoft.public.scripting.vbscript)
  • Re: Script for Folder View Customization - Beta
    ... > Are you still using explorer to view folders? ... *removing* view information from a set of folders and then tweaking the ... the shell's scripting modules are just used ... I also use some of the shell ...
    (microsoft.public.scripting.vbscript)
  • Re: Scripts that delete files, not folders.
    ... One fix and one problem for me with the deleting empty ... calling a sub" in which I fixed from a MS article. ... 'if no files or folders then delete... ... > torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway ...
    (microsoft.public.windows.server.scripting)
  • Re: Scripts that delete files, not folders.
    ... example I want to delete all files in all folders and subdirectories in the ... >> Call DeleteEmptyFolders (strFolder, False) ... >> DeleteEmptyFolders strFolder, False ... >> torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway ...
    (microsoft.public.windows.server.scripting)