Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Deleating contents of a directory.

Posted on 2000-04-21
4
Medium Priority
?
254 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 4

Accepted Solution

by:
inpras earned 200 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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 …
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

604 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