|
-
Aug 1st, 2000, 08:54 AM
#1
Thread Starter
Lively Member
how can i delete multiple files that i select from a filelist ?
can anyone help ???
-
Aug 1st, 2000, 09:01 AM
#2
Fanatic Member
Something like:
Code:
Kill (File1.Path & "\" & File1.FileName)
Gl,
D!m
-
Aug 1st, 2000, 09:04 AM
#3
Loop through the File List and kill the file if it is selected:
Code:
Private Sub DeleteFiles()
Dim i%
With File1
ChDir File1.Path
For i = .ListCount - 1 To 0
If .Selected(i) Then
Kill .List(i)
End If
Next
End With
End Sub
Good luck!
-
Jan 31st, 2003, 09:10 PM
#4
Addicted Member
Don't forget the Step -1
Originally posted by Joacim Andersson
Loop through the File List and kill the file if it is selected:
Code:
Private Sub DeleteFiles()
Dim i%
With File1
ChDir File1.Path
For i = .ListCount - 1 To 0
If .Selected(i) Then
Kill .List(i)
End If
Next
End With
End Sub
Good luck!
-
Feb 1st, 2003, 05:22 AM
#5
Whithout using a control, and a little better and faster
VB Code:
Private Sub Form_Load()
' deletes all files in myfiles
DeleteAllFiles "C:\MyFiles"
' deletes all files of type tmp
DeleteAllFiles "C:\Temp", "*.tmp"
End Sub
Private Sub DeleteAllFiles(ByVal PathName As String, Optional FileType As String = "*.*")
If Right(PathName, 1) <> "\" Then pathame = PathName & "\"
Do Until Dir(PathName & FileType, vbArchive + vbHidden) = ""
Kill PathName & Dir(PathName & FileType, vbArchive + vbHidden)
Loop
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|