473,320 Members | 1,949 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,320 software developers and data experts.

directory deletion with C++

2
hi this ashok
I want to know about....how to delete the complete NON EMPTY directory with c++ code ?
Jun 13 '07 #1
2 1486
ashokk
2
i knew how to delete empty directory but i do not how it is....
Jun 13 '07 #2
DeMan
1,806 1GB
You can try doing it recursively, the general idea would be:

(note: pseudoish code, but the logic would be much the same.....)
Expand|Select|Wrap|Line Numbers
  1. DelDir(Dir);
  2.   Foreach thisElement=Dir.element(); 
  3.     if thisElement.isDir();
  4.       DelDir(thisElement);
  5.     else
  6.       thisElement.delete();
  7.     endif
  8.   end Foreach
  9. endDelDir
  10.  
(there may be a better way though......)
Jun 13 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Tony | last post by:
Hi there, Is there any event you can catch that would you allow to cancel the deletion of a file or directory. The FileSystemEventHandler allows you to catch file operations after they have...
10
by: mansimisha | last post by:
Hi to everybody.. I need a help need to have a program to represent directory structure(a directory can contain any number of directory or files) alos write a programme to insert one element nd...
2
by: vikram.lakhotia | last post by:
Hi Have you tried deleting a directory in Asp.Net. Here is an article discussing the problem deleting a Directory in Asp.Net http://www.vikramlakhotia.com/Deleting_Directory_in_ASPnet_20.aspx...
11
by: comp.lang.php | last post by:
Once again, I thought my class method deleteZip() would do the trick, but it never deletes any .zip* file found in a directory: /** * Delete any latent ZIP files found in this album. This...
1
by: Lloyd Dupont | last post by:
In our app we have a resource manager which used a temporariy directory in the temp folder to store data while the application is runnning. To preserve the integrity of our data we need to...
5
by: Gordon | last post by:
I'm trying to remove a directory and all its contents from within a script. I wrote a recursive function to take care of it, but when I run it I get random "Directory not empty" error messages. ...
2
by: diwakar09 | last post by:
Hi, Is there any in c/c++ through which i can mark some directory or files for deletion, But this deletion should happen only on next restart of system. I have to implement it in a application...
9
by: =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?= | last post by:
``odict.byindex(index)`` For this API, I think it's important to make some performance guarantees. It seems fairly difficult to make byindex O(1), and simultaneously also make insertion/deletion...
8
by: aki | last post by:
Hi All, I describe the problem as below. A directory( path known) , contains 0 to any number of files . The file names are with following structure : ...
1
by: miztaken | last post by:
Hi there, My C# application opens a directory and deals with the files inside it. But at the mean time i can delete the directory from windows. Is there any way i can restrict the deletion of that...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.