Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Automatic file deletion
Message
 
To
16/08/2000 03:19:08
Victor Lapid
Phil. Long Distance Tel. Co.
Manila, Philippines
General information
Forum:
Visual Basic
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00405368
Message ID:
00405428
Views:
11
>Hi,
>
> I'm trying to delete files with wilcards chars (eg. "vb*.tmp")
>using FileExists (Filesystemobject class) unfortunately, it doesn't work with wilcards chars.
> Any idea.
>
> TIA.

Use Kill to delete files using wildcards.

Took from the VB help:
Kill Statement
      

Deletes files from a disk.

Syntax

Kill pathname

The required pathname argument is a string expression that specifies one or more file names to be deleted. The pathname may include the directory or folder, and the drive.

Remarks

In Microsoft Windows, Kill supports the use of multiple-character (*) and single-character (?) wildcards to specify multiple files


Kill Statement Example
This example uses the Kill statement to delete a file from a disk.

' Assume TESTFILE is a file containing some data.
Kill "TestFile"   ' Delete file.

' Delete all *.TXT files in current directory.
Kill "*.TXT"   
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Previous
Reply
Map
View

Click here to load this message in the networking platform