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!

API - Deleting Folders & SubFolders ?

Status
Not open for further replies.

redzombi19

Programmer
Jun 2, 2002
35
US
Hello,
I was wondering if anyone knows of a windows api or something that allows you to delete a folder, and all subfolders and files?
So far i have not been able to find one, so if you know of one please let me know.
thanks!
 
thanks for the reply baltman,
but i was hoping to find a api to use, (allthough, im becoming less and less hopefull that there is one)
seeing as how not all Windows OS's have windows scripting installed.
thanks again
p.s. i thought that enterd my mind was: could you copy the folder over to the recycle bin?(I know how to copy a folder and all its sub folders.), and if so what is the path to the recycle bin
 
ok let me correct myself so that you dont think im stupid, i dont mean Copy a dir a ment Move a dir. :)
 
I don't think there is an API call to delete an
entire directory tree.

I believe you'll need to iterate across the directory
subtree you want to delete and remove the files first
and then remove the empty directory roots.

Research the following API functions:

FindFirstFile() && Use a wild card to find all files
FindNextFile()
DeleteFile()
RemoveDirectry()

Hope this helps.


 
thanks DSummZZZ and darrellblackhawk,
I will give both those a try
thanks again!
 
redzombi19,

Look at your own thread:
copyfile, copydir?
thread184-567231
:)

SHFileOperation API can copy, move, rename or delete folder & subfolder.

-- AirCon --
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top