jaustin wrote:
> I would like to set up a group of folders numbered
> sequentially 0000 to 10,000 with subfolders in each that
> are given the same alphanumeric names in each folder. I
> would like to be able later to add subfolders to all files
> at one time and not have to do it individually. I want to
> use these to store a large group of scanned text pdf
> documents. Will windows 2000 support this and how can I
> set this up at one time rather than each folder and
> subfolder - one at a time? Is there a program that does
> this or a series of windows commands that will do this?
Hi
Below is a VBScript (put it in a file with .vbs as file extension and double
click on it) that will create folders from 0000 to 10000 in the folder
specified in the variable sBaseFolder.
The script will create a subfolder in the folders with the same name as the
parent folder, like this:
c:\something\0000\0000
c:\something\0001\0001
If that is not what you meant, you need to change the script line
sSubFolder = sFolder
to something else. If you wanted a fixed name for the subfolder, change it to
this:
sSubFolder = "something2"
The result will then be this:
c:\something\0000\something2
c:\something\0001\something2
' script start
Set oFSO = CreateObject("Scripting.FileSystemObject")
sBaseFolder = "c:\something\" ' note the terminating backslash
iStart = 0 ' will be converted to 0000 in the script below
iStop = 10000
On Error Resume Next ' in case the folder exists from before
oFSO.CreateFolder sBaseFolder
On Error Goto 0
For i = iStart To iStop
If i < 10000 Then
sFolder = Right("0000" & i, 4)
Else
sFolder = CStr(i)
End If
On Error Resume Next ' in case the folders exists from before
oFSO.CreateFolder sBaseFolder & sFolder
sSubFolder = sFolder
oFSO.CreateFolder sBaseFolder & sFolder & "\" & sSubFolder
On Error Goto 0
Next
MsgBox "Finished"
--
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