+ Reply to Thread
Results 1 to 3 of 3

Search a directory for a file

  1. #1
    Forum Contributor
    Join Date
    01-18-2005
    Posts
    238

    Search a directory for a file

    Could someone please help me with a piece of code that will search a directory

    \server\my folder\

    the only type of file that this folder contains is excel files.

    I want my code to delete all files that begin with DONE

    example

    DONE_134
    DONE_abc
    etc....


    Loop through all files in this folder (kill) all that have the word DONE in the filename


    thanks

    Josh

  2. #2
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi,

    Please carefully test before implementation ... !!!

    Please Login or Register  to view this content.
    HTH
    Carim

  3. #3
    Registered User
    Join Date
    02-22-2006
    Posts
    28
    lStrFileName = VBA.Dir(PrStrFolderPath & "\" & "Done*.*")
    If lStrFileName <> VBA.vbNullString Then
    deletefile
    Do
    lStrFileName = VBA.Dir()
    If lStrFileName = VBA.vbNullString Then
    Exit Do
    Else
    deletefile
    End If
    Loop

    End If


    See if the above code give you any idea.

    Thanks
    mtpSuresh

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1