Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > delete the contents inside a folder


Reply
 
Thread Tools Display Modes
  #1  
Old 03-02-2004, 07:35 AM
ncks82 ncks82 is offline
Centurion
 
Join Date: Jan 2004
Location: Malaysia, KL
Posts: 136
Default delete the contents inside a folder


is it possible to delete the contents inside a folder using VB ??

for example, i got one folder used to stored image and and i wish to delete all image inside the folder using cmdDelete.

is it possible ?
__________________
- hopefully one day i'll become programming expert like you guys -
Reply With Quote
  #2  
Old 03-02-2004, 07:38 AM
kevin_verp kevin_verp is offline
Centurion
 
Join Date: May 2002
Location: The Netherlands
Posts: 145
Default

Quote:
Originally Posted by ncks82
is it possible to delete the contents inside a folder using VB ??

for example, i got one folder used to stored image and and i wish to delete all image inside the folder using cmdDelete.

is it possible ?


Remove Files in folder:
Code:
Kill "C:\MyFolder\*.*" 'Or *.extension
Remove Folder:
Code:
RmDir "C:\MyFolder\"
Reply With Quote
  #3  
Old 03-02-2004, 07:40 AM
metaller metaller is offline
Regular
 
Join Date: Feb 2004
Location: Slovakia
Posts: 51
Default

Of course, and its like this:
Kill ("your path\*.jpeg")

Greetings,
Metaller
Reply With Quote
  #4  
Old 03-02-2004, 08:07 AM
ncks82 ncks82 is offline
Centurion
 
Join Date: Jan 2004
Location: Malaysia, KL
Posts: 136
Default

AH !!
yes, just remember !!!
anyway, thanks for the replies.~
thank you/

Kill statement.

This is the question which i wanna ask from last time..
once i performed kill statement, the file is permanently deleted ???

if yes, how can i just remove it to recycle bin ?
__________________
- hopefully one day i'll become programming expert like you guys -
Reply With Quote
  #5  
Old 03-02-2004, 09:05 AM
metaller metaller is offline
Regular
 
Join Date: Feb 2004
Location: Slovakia
Posts: 51
Default

Yes, the file is absolutely lost...
But how to do deleting to recycle bin, i dont know...
There is no help in MSDN for that question...
Browse more sites, hope you'll find the answer...

Metaller
Reply With Quote
  #6  
Old 03-02-2004, 09:43 AM
ncks82 ncks82 is offline
Centurion
 
Join Date: Jan 2004
Location: Malaysia, KL
Posts: 136
Default

Quote:
Originally Posted by metaller
Yes, the file is absolutely lost...
But how to do deleting to recycle bin, i dont know...
There is no help in MSDN for that question...
Browse more sites, hope you'll find the answer...

Metaller



thank you

here is my problem
i got a list box and i just want to delete the file in the folder where selected from the listbox.

this code cant work because when i click the delete button, nothing happen. what's wrong with this code ?
please correct me.

Code:
Private Sub cmdDelete_Click() Dim fileName As String Dim x As Integer Dim tempFile As String tempFile = App.Path & "\image\.BMP" For x = 0 To lstView.ListCount - 1 fileName = lstView.List(x) pathName = App.Path & "\image\" & fileName & ".BMP" If pathName = tempFile Then Kill tempFile End If Next x End Sub
__________________
- hopefully one day i'll become programming expert like you guys -
Reply With Quote
  #7  
Old 03-28-2004, 05:31 AM
Jamesanthony's Avatar
Jamesanthony Jamesanthony is offline
Contributor
 
Join Date: May 2003
Location: Dublin
Posts: 502
Default

Private Sub cmdDelete_Click()

Dim fileName As String
Dim x As Integer
Dim tempFile As String
tempFile = App.Path & "\image\.BMP"

For x = 0 To lstView.ListCount - 1
fileName = lstView.List(x)
if ucase(right(filename,3))="BMP" then Kill tempFile
Next x
End Sub

Try this
JamesAnthony
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
delete folder deepakaa General 5 12-02-2003 10:20 PM
Need help, Fill a drop down menu with contents of a folder GT112 General 4 09-14-2003 03:43 PM
Deleting Folder Contents (ASP Help) toothpick General 7 07-12-2003 04:03 PM
Delete a folder and files within it lamar_air General 4 06-07-2002 09:17 AM
delete folder that has file inside kannanvenkatesh General 3 05-20-2002 01:34 PM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->