RenameFile('c:\MonFichier1.txt','c:\MonFichier2.txt');
CreateDirectory('c:\MonRepertoire',nil);
ForceDirectories('C:\MonRepertoire\SousDossier1\Sousdossier2');
MoveFileEx('c:\MonRepertoire\','a:\MonRepertoire',MoveFile_Copy_Allowed);
MoveFile('c:\MonRepertoire.txt','a:\MonRepertoire.txt');
DeleteFile('c:\MonFichier.txt');
if FileExists('c:\MonFichier.txt') then ShowMessage('Ce fichier existe') else ShowMessage('Ce fichier n''existe pas');
if DirectoryExists('c:\MonFichier.txt') then ShowMessage('Ce dossier existe') else ShowMessage('Ce dossier n''existe pas');
CopyFile('c:\MonFichier1.txt','c:\MonFichier2.txt',true);
setfileattributes('C:\MonRepertoire',FILE_ATTRIBUTE_HIDDEN);
setfileattributes('C:\MonRepertoire',FILE_ATTRIBUTE_NORMAL);
var Dir: TSearchRec; a : Integer; begin a := FindFirst('C:\MonRepertoire\*.*', FaAnyfile, Dir); while a = 0 do begin if ((Dir.Attr and FaDirectory <> FaDirectory) and (Dir.Attr and FaVolumeId <> FaVolumeID)) then if DeleteFile(pChar('C:\repertoire' + Dir.Name))= false then ShowMessage('Destruction impossible'); a := FindNext(Dir); end; SysUtils.FindClose(Dir); if RemoveDirectory('C:\repertoire') = false then ShowMessage('Destruction impossible'); end;
if DirectoryExists('c:\MonRepertoire') then ShowMessage('Ce dossier existe') else ShowMessage('Ce dossier n''existe pas');
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionif DirectoryExists('C:\TRUC') then ShellExecute(Handle,'open','cmd.exe','/C RMDIR/Q/S C:\TRUC',0,SW_HIDE);