1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
/*
Arborescence :
..\Repertoire
| Sous repertoire
| | plusieurs fichiers
| plusieurs fichiers
*/
TSearchRec sr;
String SourcePath = Caption ;
bool Ok = true ;
/*
** Supprime les fichiers contenus dans le sous repertoire...
*/
if (FindFirst(VerifDoubleSlash( SourcePath )+ VerifDoubleSlash( PATH_ORDER ) + "*.*", faArchive, sr) == 0) {
Ok = DeleteFile (sr.Name.c_str()) ;
while ((Ok) && (FindNext(sr) == 0)) Ok = DeleteFile (sr.Name.c_str()) ;
FindClose(sr);
if (!Ok) {
Application->MessageBox(MSG_PB_SUPP.c_str(), MSG_CIRIS.c_str(), MB_OK);
return ;
}
}
/*
** Supprime les fichiers contenus dans le repertoire...
*/
if (FindFirst(SourcePath+"\\*.*", faArchive, sr) == 0) {
Ok = DeleteFile (sr.Name.c_str()) ;
while ((Ok) && (FindNext(sr) == 0)) Ok = DeleteFile (sr.Name.c_str()) ;
FindClose(sr);
if (!Ok) {
//Application->MessageBox(MSG_PB_SUPPR.c_str(), MSG_CIRIS.c_str(), MB_OK);
//return ;
}
}
SetCurrentDir (SourcePath) ;
/*
** Tente de supprimer 'Sous repertoire' mais échoue...
*/
Ok = RemoveDir (VerifDoubleSlash( SourcePath ) + PATH_ORDER) ;
SetCurrentDir (RepertoireLogiciel) ;
/*
** Echoue forcement, car 'Sous repertoire est toujours présent...
*/
Ok = RemoveDir (SourcePath) ; |
Partager