Smart Delete Files And Smart Delete Folders Routines? 
Author Message
 Smart Delete Files And Smart Delete Folders Routines?

Public Sub DeleteOfFiles(ByVal thePath As String, ByVal theMatch As

        Dim theFileSystem As FileSystemObject, _
            theFolder As Folder, _
            theFile As Scripting.File, _
            theSubFolder As Folder


        theFileSystem = New FileSystemObject

        With theFileSystem


            theFolder = .GetFolder _

            For Each theFile In theFolder.Files


                theFile. _



            For Each theSubFolder In theFolder.SubFolders


                Call DeleteOfFiles _
                    (theSubFolder.Path, theMatch)


        End With

    End Sub

The above routine would delete all files... but what I need is to
delete only the files, or subfolders, that match a given
specification.  In either case all matches are deleted in refence to
files or folders based on the match pattern.

For example...  D:\_FOLDER\-*.* would delete all files that start with
'-' symbol, and all files in all subfolders that start with '-'.

Another example...  D:\_FOLDER\-*. would delete all subfolders that
start with '-' symbol.

Can anyone help with this?

Sun, 02 Oct 2005 13:09:41 GMT  
 [ 1 post ] 

 Relevant Pages 

1. How to delete folders/files within a folder but not the folder itself

2. Deleting mails in deleted folder

3. Programmatically delete Deleted Items folder once a day

4. Delete without going to deleted items folder !

5. Deleting certian Files in Folders and there sub folders

6. info : here is how to delete cookies or any file in the temporary internet files folder

7. SQL delete query deletes but does not delete

8. Find and Delete File Routine

9. .config file with smart client

10. Corrected: Deleting Prog Man Grp and Deleting Files

11. Deleting Prog Man Grp and Deleting Files

12. Deleted records when text file is linked as table (#deleted)


Powered by phpBB® Forum Software