Void Removetree (CString strparent) // recursive function {cstring stramp; cfilefind f; bool bfind = f.findfile (strparent "*. *"); while (bfind) {bfind = f.findnextFile (); if (f. ISDOTS ()) Continue; // File name "." Or ".." folder IF (f.IsDirectory ()) // folder {stratmp = strparent f.GetFileName () "//"; Removetree (strtmp); if (! RemoveDirectory ("Remove Directory% s Fial./N" ,strtmp.getBuffer (0));}} else // file {stramp = strparent f.GetFileName ); If (! DELETEFILE (STRTMP)) {Printf ("delete file% s fial./n" ,strtmp.getBuffer (0));}}}}
Void RemovedirandContent (CString strdir) {transovetree (strdir); if (! Removedirectory (strdir)) {Printf ("Remove Directory% s fial./n" ,strdir.getBuffer (0));}}
int _tmain (int argc, TCHAR * argv [], TCHAR * envp []) {CString strCurtDir; GetCurrentDirectory (_MAX_PATH, strCurtDir.GetBuffer (_MAX_PATH)); strCurtDir.ReleaseBuffer (); RemoveDirAndContent (strCurtDir "// test // "); Returnograph;}