D�termine si un fichier ou un dossier existe.
FileExists ( "path" )
Path | Chemin du r�pertoire ou du fichier � v�rifier. |
Succ�s: | Retourne 1. |
�chec: | Retourne 0 si le fichier ou le r�pertoire n'existe pas. |
FileExists() retourne 0 si vous sp�cifiez un lecteur qui ne contient pas de m�dia.
Si vous ex�cutez un script en mode X86 (@AutoItX64 = 0) sous un Windows qui s"ex�cute en mode X64 (@OSArch = "X64") et si vous voulez acc�der � @WindowsDir\System32, les fichiers X64 seront introuvables. Vous pouvez alors utiliser @WindowsDir\Sysnative.
#include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> Example() Func Example() ; Cr�e une constante locale du chemin du fichier qui sera lu/�crit. Local Const $sFilePath = _WinAPI_GetTempFileName(@TempDir) Local $iFileExists = FileExists($sFilePath) ; Affiche si le fichier existe ou pas. If $iFileExists Then MsgBox($MB_SYSTEMMODAL, "", "Le fichier existe." & @CRLF & "FileExist a retourn�: " & $iFileExists) Else MsgBox($MB_SYSTEMMODAL, "", "Le fichier n'existe pas." & @CRLF & "FileExist a retourn�: " & $iFileExists) EndIf ; Supprime le fichier temporaire. FileDelete($sFilePath) EndFunc ;==>Example