Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Automatic file deletion
Message
 
To
16/08/2000 08:41:02
Victor Lapid
Phil. Long Distance Tel. Co.
Manila, Philippines
General information
Forum:
Visual Basic
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00405368
Message ID:
00405818
Views:
16
>Igor,
>
>
> Sorry , I'd rather re-phrase my question, how to check existence of those files eg. vb*.tmp then perform automatic deletion ->(Kill app.path "\vb*.tmp")

Hi Victor,

Take a look at the code. Is this what you want?
    Dim objFSO As New FileSystemObject
    Dim objFolder As Folder
    Dim objFile As File
    Dim strPath as String

    strPath = "C:\Temp"
    Set objFolder = objFSO.GetFolder(strPath)
    
    For Each objFile In objFolder.Files
        If Right(objFile.ShortName, 3) = "TMP" Then
            ' Your code goes here ....
            ' Let's delete the file
            objFile.Delete
        End If
    Next

    Set objFSO = nothing
    Set objFolder = nothing
    Set objFile = nothing
HTH, Igor
Igor Gelin
Database Developer
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform