473,406 Members | 2,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Deleting a folder

I am using Visual Studio .NET 2005 to create a Windows Forms
application. I know that I can use My.Computer.FileSystem.DeleteFile to
delete a file. How do I delete an empty folder/directory though? How
could I delete a folder that wasn't empty?

Sep 6 '06 #1
3 1086
"BobRoyAce" <br**@omegasoftwareinc.comschrieb:
>I am using Visual Studio .NET 2005 to create a Windows Forms
application. I know that I can use My.Computer.FileSystem.DeleteFile to
delete a file. How do I delete an empty folder/directory though? How
could I delete a folder that wasn't empty?
'My.Computer.FileSystem.DeleteDirectory'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Sep 6 '06 #2
Hi BobRoyAce,

I tried

Try
System.IO.Directory.Delete("C:\test", True)
Catch ex As Exception
MsgBox(ex.message.tostring)
End Try
Have a look at http://msdn2.microsoft.com/en-us/library/fxeahc5f.aspx for
more information

Best regards,

Chris

"BobRoyAce" <br**@omegasoftwareinc.comwrote in message
news:11*********************@h48g2000cwc.googlegro ups.com...
>I am using Visual Studio .NET 2005 to create a Windows Forms
application. I know that I can use My.Computer.FileSystem.DeleteFile to
delete a file. How do I delete an empty folder/directory though? How
could I delete a folder that wasn't empty?

Sep 6 '06 #3
Yea, that would make sense...thanks. I looked for DeleteFolder...never
even looked for DeleteDirectory!

Herfried K. Wagner [MVP] wrote:
"BobRoyAce" <br**@omegasoftwareinc.comschrieb:
I am using Visual Studio .NET 2005 to create a Windows Forms
application. I know that I can use My.Computer.FileSystem.DeleteFile to
delete a file. How do I delete an empty folder/directory though? How
could I delete a folder that wasn't empty?

'My.Computer.FileSystem.DeleteDirectory'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Sep 6 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: georgios zakitraxis | last post by:
Hi all, I have a folder with many pictures in it. All have the name like: HHMMDDMMYYYY.jpg H-hour M-minute D-day M-month Y-year
8
by: phpfrizzle | last post by:
Hi there, I have built a CMS, and in one part you have to be able to delete images. Structure like this: _root --> folder "img" --> file "1.jpg" --> file "2.jpg" --> folder "CMS" ...
5
by: Rosa | last post by:
Hi, I'm trying to clear the TIF on Windows XP programmatically with the below code. This code works fine on any folder but the TIF. For some reason the atEnd() statements always defaults to true...
13
by: Bob Darlington | last post by:
I have a repair and backup database routine which runs when a user closes down my application. It works fine in my development machine, but breaks on a client's at the following line: If...
6
by: Martin Bischoff | last post by:
Hi, I'm creating temporary directories in my web app (e.g. ~/data/temp/temp123) to allow users to upload files. When I later delete these directories (from the code behind), the application...
5
by: George | last post by:
VB.net 2003 standard, XP windows home edition. Installed first application OK today. When I removed the application via Control Panel, there were no problems and the app folders were deleted. ...
0
by: steven.shannon | last post by:
Hello, I'm writing an app that involves deleting all the items in a specified Outlook folder regardless of item type (i.e. Contacts, Tasks, etc.). This code was ported from VBA where it worked...
5
by: Sandeep Singh Sekhon | last post by:
I am Developing a Web Application with ASP.NET 1.1 I have one project Folder which is virtual directory of IIS. In this directory, I have one Folder named Photos in which I used to Store Photos....
3
by: Kimera.Kimera | last post by:
I'm trying to write a program in VB.net 2003 that basically deletes all files, folders, sub-folders and sub-sub folders (etc). The program is simply for deleting the Windows/Temp folder contents,...
0
by: rahuldhammy | last post by:
I am implementing a personalization(customizing the contents of the web site according to the user choice)in asp.net web site.For this i have to delete modify some files in my App_Themes folder.I am...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.