Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I recursively remove files from directories?

Status
Not open for further replies.

Vovin

Programmer
Aug 24, 2003
63
GB
Hi,

does anyone have a small elegant piece of code (in C) that recursively remove files from directories. Thanks.
 
Alas, (recursive) directory scanning (to remove files or what else) is OS-dependent operation. No such functions in C Standard Library...
 
Thanks ArkM, I managed to cobble something together that did the job.
 
Be warned. Deletion of files DURING your directory scan CAN make the directory scan skip a file. You may find some files being left behind.

Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top