Custom indexing on sub folders

Posted on 2010-01-08
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
    LVL 38

    Expert Comment

    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

    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

    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

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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    It is a known fact that servers reach the end of their lives. Some get there quicker than others, based on age, manufacturer, usage and several other factors. However, if your organization has spent time deploying Microsoft's Active Directory server…
    Preface Having the need * to contact many different companies with different infrastructures * do remote maintenance in their network required us to implement a more flexible routing solution. As RAS, PPTP, L2TP and VPN Client connections are no…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    761 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

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now