Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2004
    Posts
    118

    Unanswered: Is there any way to search for filenames from access?

    I got a long list of filenames and their assosiated path.

    Some of those files dont exist and i need them listed.

    Is there any way to do that?

  2. #2
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Here is a gide for you
    You can make a RecordSet called rsFiles containing the fileName, fileSize and fileDate from a table

    PHP Code:
      Dim Datei As Variant


      With Application
    .FileSearch
        
    .NewSearch
        
    .lookin "c:\"
        .SearchSubFolders = True
        .filename = "
    *.*"
        If .Execute > 0 Then
          For Each Datei In .foundfiles
            rsFiles.AddNew
               rsFiles("
    fileName") = Datei
               rsFiles("
    fileSize") = FileSystem.FileLen(Datei) & " KB"
               rsFiles("
    fileDate") = FileSystem.FileDateTime(Datei)
             rsFiles.Update        
          Next
        End If
       End With 
    now you have all found items stored in your table

  3. #3
    Join Date
    Apr 2004
    Location
    Derbyshire, UK
    Posts
    789
    Provided Answers: 1
    Alternatively you could use the Dir function ie

    if Dir("C:\Somepath\somefile.ext")="" the


    end if

  4. #4
    Join Date
    Apr 2004
    Location
    Derbyshire, UK
    Posts
    789
    Provided Answers: 1

    Serching for files

    Sorry posted before I had finished

    if Dir("C:\Somepath\somefile.ext")="" the
    'File does not exist'
    else
    'File exists'
    end if

    If use specify a unique file name (ie without wid card characters) then it will return the file neme if it exists or a blank (empty) string if it does not.

    I fyou use wild cads it returns a list which is accessed if sequence by using dir (without the argument brackets).

    The help file givesmore info (and a better explanation).

    MTB

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •