void list (String Dir, TIdFTP * ftp, TMemo *m){ static String mainDir = Dir; ftp->ChangeDir(Dir); ftp->List("",true); int count = ftp->DirectoryListing->Count; if (count == 0) { String dir = ftp->RetrieveCurrentDir(); ftp->ChangeDirUp(); ftp->RemoveDir(dir); //main Dir = Dir = "/x String a =ftp->RetrieveCurrentDir(); if (ftp->RetrieveCurrentDir() == mainDir) { return ; } list (ftp->RetrieveCurrentDir(), ftp, m); }else{ for (int i = 0; i < count; i++) { //carpeta if (ftp->DirectoryListing->Items[i]->ItemType == ditDirectory) { list (ftp->DirectoryListing->Items->FileName, ftp, m); } if (ftp->DirectoryListing->Items->ItemType == ditFile) { ftp->Delete(ftp->DirectoryListing->Items->FileName); list (ftp->RetrieveCurrentDir(), ftp, m); } } } }
Espero me puedan ayudar . Slaudos y gracias
edito: Me tove la libertad de acomodar tu codigo para que se entienda.