Custom indexing on sub folders

I have a set of documents that two different groups need to use. Our customer service people use Part Number when dealing with the customer and our shop workers use Die Number when producing parts. I'd like a program that will build a custom index based on the die numbers so that a user clicking on the die number will open the subfolder. I have attached the proposed folder structure. There will be multiple customer names and multiple part numbers inside each customer name. There could even be multiple die numbers inside each part number.

Is this possible? I'd like to avoid having the shop workers use windows search every time they need to load a program. Thanks.
Customer Files
  >  Customer Name
    >  Part Number
      >  PO
      >  Prints
      >  Die Number
        >  Programs
      >  Other Documents

Open in new window

Who is Participating?
Paste the script below into a text file with a .vbs extension.  Customize the value of the strRoot variable on line 4 with the location of the Customer Files folder.  Be sure to use the same drive letter or UNC path which users will access the files by.  Customize the value of the strOutput variable on line 5 with the location of the index file to create.

This VBScript does not require installing any additional software.  Running it will scan the folder structure and create an HTML file with links to each die number's folder.  It could be set up to run periodically with a scheduled task to refresh the index if the folders change.

Const adVarChar = 200
Const MaxCharacters = 255
strRoot = "C:\Customer Files"
strOutput = "C:\Index.htm"
strPattern = ".*\\([A-Z]\d{6,6})$"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objOutput = objFSO.CreateTextFile(strOutput, True)
Set DataList = CreateObject("ADOR.Recordset")
DataList.Fields.Append "DieNumber", adVarChar, MaxCharacters
DataList.Fields.Append "Path", adVarChar, MaxCharacters
strCommand = "cmd /c @echo off & dir " & _
    Chr(34) & strRoot & Chr(34) & " /a:d /b /s"
Set objShell = CreateObject("WScript.Shell")
Set objWshScriptExec = objShell.Exec(strCommand)
Set objStdOut = objWshScriptExec.StdOut
strList = objWshScriptExec.StdOut.ReadAll
Set objRegExp = New RegExp
objRegExp.Pattern = strPattern
objRegExp.IgnoreCase = True
objRegExp.Global = True
objRegExp.MultiLine = True
Set objMatches = objRegExp.Execute(strList)
For Each objMatch in objMatches
    DataList("DieNumber") = objMatch.SubMatches(0)
    DataList("Path") = objMatch.Value
DataList.Sort = "DieNumber"
Do Until DataList.EOF
    objOutput.WriteLine "<A HREF=" & Chr(34) & "file://" & _
        DataList.Fields.Item("Path") & Chr(34) & ">" & _
        DataList.Fields.Item("DieNumber") & "</A><BR>"

Open in new window

Can the same die number exist under different part numbers and/or different customers?  If so, should there be multiple entries in the index to reflect that?

Can you give an example of how you would like the index to look?  Omit any sensitive information.

Would a script which generates an HTML page containing links to the subfolders suit your needs?
leviatdrAuthor Commented:
No, the same die number will not be repeated, they are unique.

Basically, I'd like to just have a listing of the die numbers, sorted alphabetically.

An HTML page might work, where each hyperlink points to the die number folder. The die numbers are always in the format X000000 where X is an alpha character and 0 is a number. They will also always be at the same level in the folder structure. I guess it would be pretty easy to generate that with PHP or Perl. I don't have either installed on any of our file servers, but that's fairly trivial. Thanks for the response.
leviatdrAuthor Commented:
I still need to move this into production, but the tests have worked flawlessly. Thank you.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.