PC Review


Reply
Thread Tools Rate Thread

Automatic generation of folders and subfolders

 
 
jaustin
Guest
Posts: n/a
 
      21st Dec 2003
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?
 
Reply With Quote
 
 
 
 
Torgeir Bakken (MVP)
Guest
Posts: n/a
 
      21st Dec 2003
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


 
Reply With Quote
 
Bill James
Guest
Posts: n/a
 
      21st Dec 2003
A simple script can create the folder structure for you, although it will take several minutes with this many folders. I would recommend not starting at the root drive for this folder structure, but starting in a sub folder, and the computer you are creating the folders on should be formatted NTFS file system. I hope you have a big hard drive.

Here is a sample, you can easily change the starting folder and subfolder names.

Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")

Dim BaseFldr
BaseFldr = "C:\aaaTest"

Dim Sub1, Sub2, Sub3, Sub4, Sub5
Sub1 = "Folder 1"
Sub2 = "Folder 2"
Sub3 = "Folder 3"
Sub4 = "Folder 4"
Sub5 = "Folder 5"

Dim i, s

If NOT fso.FolderExists(BaseFldr) Then fso.CreateFolder(BaseFldr)

For i = 0 to 10000
s = BaseFldr & "\" & Right("0000" & i, 5)
If NOT fso.FolderExists(s) Then fso.CreateFolder(s)
If NOT fso.FolderExists(s & "\" & Sub1) Then fso.CreateFolder(s & "\" & Sub1)
If NOT fso.FolderExists(s & "\" & Sub2) Then fso.CreateFolder(s & "\" & Sub2)
If NOT fso.FolderExists(s & "\" & Sub3) Then fso.CreateFolder(s & "\" & Sub3)
If NOT fso.FolderExists(s & "\" & Sub4) Then fso.CreateFolder(s & "\" & Sub4)
If NOT fso.FolderExists(s & "\" & Sub5) Then fso.CreateFolder(s & "\" & Sub5)
Next

MsgBox "Finished Creating Folders"

--

Bill James
Microsoft MVP - Shell/User

Win9x VBScript Utilities » www.billsway.com/vbspage/
Windows Tweaks & Tips » www.billsway.com/notes_public/

"jaustin" <(E-Mail Removed)> wrote in message news:05ee01c3c7db$a60d2370$(E-Mail Removed)...
> 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?

 
Reply With Quote
 
jaustin
Guest
Posts: n/a
 
      21st Dec 2003
thank you very much for your thoughtful replies - jim
austin
>-----Original Message-----
>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?
>.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
When synchronizing offline folders and subfolders, folders don't a =?Utf-8?B?bGRlc2lnbmVy?= Windows XP Help 0 15th Apr 2005 07:44 PM
Prevent automatic generation of folders like \Program Files\netmeeting? Spartanicus Microsoft Windows 2000 0 11th Feb 2005 08:22 AM
Automatic # generation jmunderpar Microsoft Access Form Coding 3 1st Oct 2004 05:28 PM
Synchronization for folders and all subfolders not working for subsequent new folders cptcrush@netzero.com Microsoft Outlook 0 15th May 2004 12:54 AM
Automatic row generation Kyle80 Microsoft Excel Worksheet Functions 0 3rd Sep 2003 04:32 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:09 PM.