FileSystem: Serach File


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: FileSystem: Serach File

  1. #1
    woogor Guest

    FileSystem: Serach File


    I have 5000+ PDF files sitting in 300+ folders. I am not using any type of
    database.

    By using ASP, Can I:
    1)Search for a file name, i.e. asp*.PDF or *asp.PDF; and,
    2)Search for content, i.e. About ASP.

    Please do NOT assume to use Windows Explorer to do the search.

    Your prompt reply with a sample of code is appreciated.


  2. #2
    unifav Guest

    Re: FileSystem: Serach File


    From ASP, you can use Scripting.FilesystemObject for this purpose. This will
    give you some ideas:

    ==================================
    ' Returns filename with specified extension. If more than one *.INI
    ' file exists, the first file found is returned.
    MyFile = Dir("C:\WINDOWS\*.INI")

    ' Call Dir again without arguments to return the next *.INI file in the
    ' same directory.
    MyFile = Dir()

    ' Return first *.TXT file, including files with a set hidden attribute.
    MyFile = Dir("*.TXT", vbHidden)

    ' Display the names in C:\ that represent directories.
    MyPath = "c:\" ' Set the path.
    MyName = Dir(MyPath, vbDirectory) ' Retrieve the first entry.
    Do While MyName <> "" ' Start the loop.
    ' Use bitwise comparison to make sure MyName is a directory.
    If (GetAttr(MyPath & MyName) And vbDirectory) = vbDirectory Then
    ' Display entry only if it's a directory.
    Debug.WriteLine(MyName)
    End If
    MyName = Dir() ' Get next entry.
    Loop
    ==================================
    For further knowledge on FilesystemObject API and usage, see http://msdn.microsoft.com/library/de...ce09072000.asp

    Hope that helps.
    -Biswa.

    "woogor" <zhang5gor@yahoo.com> wrote:
    >
    >I have 5000+ PDF files sitting in 300+ folders. I am not using any type

    of
    >database.
    >
    >By using ASP, Can I:
    >1)Search for a file name, i.e. asp*.PDF or *asp.PDF; and,
    >2)Search for content, i.e. About ASP.
    >
    >Please do NOT assume to use Windows Explorer to do the search.
    >
    >Your prompt reply with a sample of code is appreciated.
    >



  3. #3
    Douglas J. Steele Guest

    Re: FileSystem: Serach File

    Where are you using FileSystemObject in your example? Looks like straight
    VBScript to me.

    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele


    "unifav" <unifav@singapore.com> wrote in message
    news:3ddb1977$1@tnews.web.devx.com...
    >
    > From ASP, you can use Scripting.FilesystemObject for this purpose. This

    will
    > give you some ideas:
    >
    > ==================================
    > ' Returns filename with specified extension. If more than one *.INI
    > ' file exists, the first file found is returned.
    > MyFile = Dir("C:\WINDOWS\*.INI")
    >
    > ' Call Dir again without arguments to return the next *.INI file in the
    > ' same directory.
    > MyFile = Dir()
    >
    > ' Return first *.TXT file, including files with a set hidden attribute.
    > MyFile = Dir("*.TXT", vbHidden)
    >
    > ' Display the names in C:\ that represent directories.
    > MyPath = "c:\" ' Set the path.
    > MyName = Dir(MyPath, vbDirectory) ' Retrieve the first entry.
    > Do While MyName <> "" ' Start the loop.
    > ' Use bitwise comparison to make sure MyName is a directory.
    > If (GetAttr(MyPath & MyName) And vbDirectory) = vbDirectory Then
    > ' Display entry only if it's a directory.
    > Debug.WriteLine(MyName)
    > End If
    > MyName = Dir() ' Get next entry.
    > Loop
    > ==================================
    > For further knowledge on FilesystemObject API and usage, see

    http://msdn.microsoft.com/library/de...us/dnofftalk/h
    tml/office09072000.asp
    >
    > Hope that helps.
    > -Biswa.
    >
    > "woogor" <zhang5gor@yahoo.com> wrote:
    > >
    > >I have 5000+ PDF files sitting in 300+ folders. I am not using any type

    > of
    > >database.
    > >
    > >By using ASP, Can I:
    > >1)Search for a file name, i.e. asp*.PDF or *asp.PDF; and,
    > >2)Search for content, i.e. About ASP.
    > >
    > >Please do NOT assume to use Windows Explorer to do the search.
    > >
    > >Your prompt reply with a sample of code is appreciated.
    > >

    >




  4. #4
    Jake Guest

    Re: FileSystem: Serach File


    I use ADO to query the Microsoft Indexing Service. These links should get
    you started.

    Indexing Service Start Page
    http://msdn.microsoft.com/library/de...tpage_6td1.asp

    ADO - Microsoft OLE DB Provider for Microsoft Indexing Service
    http://msdn.microsoft.com/library/de...rvprovspec.asp

    Some Other Links on Microsoft Indexing Service
    http://www.windowswebsolutions.com/A...rticleID=20593
    http://www.windowswebsolutions.com/A...rticleID=21223
    http://www.simongibson.com/intranet/...indexserv.html


    Jake Duckworth


    "woogor" <zhang5gor@yahoo.com> wrote:
    >
    >I have 5000+ PDF files sitting in 300+ folders. I am not using any type

    of
    >database.
    >
    >By using ASP, Can I:
    >1)Search for a file name, i.e. asp*.PDF or *asp.PDF; and,
    >2)Search for content, i.e. About ASP.
    >
    >Please do NOT assume to use Windows Explorer to do the search.
    >
    >Your prompt reply with a sample of code is appreciated.
    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center