Custom indexing on sub folders

Posted on 2010-01-08
Medium Priority
Last Modified: 2012-05-08
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

Question by:leviatdr
  • 2
  • 2
LVL 38

Expert Comment

ID: 26211175
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?

Author Comment

ID: 26211265
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.
LVL 38

Accepted Solution

Shift-3 earned 2000 total points
ID: 26212208
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


Author Closing Comment

ID: 31674577
I still need to move this into production, but the tests have worked flawlessly. Thank you.

Featured Post

Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

On July 14th 2015, Windows Server 2003 will become End of Support, leaving hundreds of thousands of servers around the world that still run this 12 year old operating system vulnerable and potentially out of compliance in many organisations around t…
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question