468,512 Members | 1,519 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,512 developers. It's quick & easy.

How to delete all files in a directory

Hi..
I m new to c++ and to this forum. I tried searching the forum on this topic but found complex solution. Can't their be a simple solution to this.
I tried the following

DeleteFile(".\\ProcFiles\\*.*");

RemoveDirectory(".\\ProcFiles");

But they are not helping me in deleting all files from a directory
Dec 13 '07 #1
2 7404
oler1s
671 Expert 512MB
Wait, wait. You guessed the function that would delete files? I'm not entirely sure how to respond to something like this.

In any case, properly checking documentation or Googling would reveal: http://www.cplusplus.com/reference/c...io/remove.html
Dec 13 '07 #2
Hi,

U can use the SetCurrentDirectory () to set the path of the Directory u want to empty. Once done, use the SHFileOperation (). Take precautions while filling the SHFILEOPSTRUCT structure. This should do the needfull for u.
Dec 13 '07 #3

Post your reply

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

Similar topics

5 posts views Thread by Jobs | last post: by
3 posts views Thread by Arpan | last post: by
7 posts views Thread by Anil Gupte | last post: by
24 posts views Thread by biganthony via AccessMonster.com | last post: by
Airslash
2 posts views Thread by Airslash | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.