Solved

Deleating contents of a directory.

Posted on 2000-04-21
4
222 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 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
either24  challenge 19 105
haveThree challenge 22 123
building a service to accessed via telnet client, want colors ? 4 98
firstChar challenge 13 133
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.

726 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