?
Solved

Deleting Files

Posted on 2003-02-28
6
Medium Priority
?
169 Views
Last Modified: 2010-05-01
In VB 6, what code can I use to delete files from a directory?
0
Comment
Question by:Patsfan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 8043181
you can use the VB Kill statement
0
 
LVL 18

Expert Comment

by:bobbit31
ID: 8043186
Kill "C:\my documents\*.*"
0
 
LVL 18

Expert Comment

by:bobbit31
ID: 8043189
sorry for the dup post emoreau
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:Patsfan
ID: 8043331
Thanks!  It worked fine.
0
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 200 total points
ID: 8043573
To close the question, you need to accept one of the comment. You will find a button for this on the gray bar separating comments.
0
 

Expert Comment

by:BlueSky007
ID: 8054370
Try this code (API):

Private Declare Function DeleteFile Lib "kernel32" Alias "DeleteFileA" (ByVal lpFileName As String) As Long


DeleteFile "C:\KPD-Team\test.kpd"


If you what to delete more files use FINDFIRSTFILE function, after that use FindNextFunction. This is more usefull if you have System File, Hiden or ReadOnly Files

Declare Function FindFirstFile Lib "kernel32" Alias "FindFirstFileA" (ByVal lpFileName As String, lpFindFileData As WIN32_FIND_DATA) As Long

Declare Function FindNextFile Lib "kernel32" Alias "FindNextFileA" (ByVal hFindFile As Long, lpFindFileData As WIN32_FIND_DATA) As Long
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month10 days, 11 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question