|
간단한 프로그램 같은데..
잘안되네요..
디렉토리와 서브 폴더에서 description.sdo 파일을 발견하면
삭제하는 프로그램을 만들려고 하는데..잘안되네요..
고수님의 조언을 부탁드립니다...
void __fastcall TForm1::DirRecursiveScan(String path)
{
//TODO: Add your source code here
try
{
if(String(path.AnsiLastChar()) != "\\") path += "\\";
AnsiString fpath, SaveEn, currpath, Filename;
TSearchRec sr;
char *pszBuffer;
int inFile;
int iFileLen;
int Found = FindFirst(path + "*.*", faArchive | faDirectory, sr);
while(Found == 0)
{
fpath = path + sr.Name;
if(*sr.Name.c_str() != '.')
{
if(DirectoryExists(fpath)) DirRecursiveScan(fpath);
else
{
if(sr.Name=="description.sdo")
{
DeleteFile(sr.Name);
}
}
}
Found = FindNext(sr);
}
FindClose(sr);
}
catch(Exception *e)
{
throw e;
}
}
void __fastcall TForm1::Button1Click(TObject *Sender)
{
String path ="c:\\ex1";
DirRecursiveScan(path);
ShowMessage(" 작업이 완료됨");
}
|