Solved

Deleating contents of a directory.

Posted on 2000-04-21
4
216 Views
Last Modified: 2013-11-20
Haw can I delete a contents of a directory which contains sub directories?
I tryed to use FindFirstFile, FindNextFile and DeleteFile but it deleted only the files.
Thanks,
Ilan Hindy.
0
Comment
Question by:HindyIlan
  • 2
4 Comments
 
LVL 4

Accepted Solution

by:
inpras earned 50 total points
ID: 2737185
Use SHFileOperation For that
0
 

Expert Comment

by:imtiazahmad
ID: 2737341
Use CFileFind class to find the files in the directory and then use SHFileOperation to delete the files
0
 

Author Comment

by:HindyIlan
ID: 2743075
My program is without GUI. I Tryed to write the following code and got 0 (= fail) as a return. can you tell me why?
(The directory exist and contains several files and sub directories)

SHFILEOPSTRUCT FileOpStruct;
      FileOpStruct.hwnd = NULL;
      FileOpStruct.pFrom = "f:\\Working Folders\\input and output";
      FileOpStruct.pTo = NULL;
      FileOpStruct.wFunc = FO_DELETE;
      FileOpStruct.fFlags =      FOF_NOCONFIRMATION |
                                          FOF_NOERRORUI         |
                                          FOF_SILENT;
      int x = SHFileOperation(&FileOpStruct);

0
 

Author Comment

by:HindyIlan
ID: 2743485
Sorry my mistake (The last comment)
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
repeatEnd java challenge 42 85
Expand LInux Boot partition remotly 3 96
Unix / Linux grid computing 5 162
Excel file not created as expected 7 79
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

790 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