Page 1 sur 1
[R] Commande équivalente à If FileExists pour un dossier ?
Posté : mar. 02 déc. 2008 15:18
par delvig
Bonjour,
Quelle est la commande équivalente à IfFileExists pour un dossier, svp ?
Merci.
Patrice
Re: Commande équivalente à IfFileExists pour dossier ?
Posté : mar. 02 déc. 2008 15:22
par Yogui
Bonjour,
Merci de respecter les règles du forum
disponible ICI et mettre la balise [..]
sinon comme indiqué dans l'aide pour la fonction :FileExists:
Code : Tout sélectionner
Checks if a file or directory exists.
FileExists ( "path" )
Parameters
Path The directory or file to check.
Vérifie si le fichier ou le repertoire existe
Re: Commande équivalente à IfFileExists pour dossier ?
Posté : mar. 02 déc. 2008 15:52
par delvig
Merci, mais je n'ai pas très bien compris. Si par exemple je veux vérifier que le dossier "c:\Windows\Rapport" existe, quelle commande dois-je taper exactement ?
If FileExists "c:\Windows\Rapport" Then .......... ou autre chose ?
Merci encore.
Patrice
Re: [..]Commande équivalente à IfFileExists pour dossier ?
Posté : mar. 02 déc. 2008 16:02
par Yogui
je reprend l'exemple de l'aide :
Code : Tout sélectionner
If FileExists("C:\autoexec.bat") Then
MsgBox(4096, "C:\autoexec.bat File", "Exists")
Else
MsgBox(4096,"C:\autoexec.bat File", "Does NOT exists")
EndIf
If FileExists("C:\") Then
MsgBox(4096, "C:\ Dir ", "Exists")
Else
MsgBox(4096,"C:\ Dir" , "Does NOT exists")
EndIf
If FileExists("D:") Then
MsgBox(4096, "D: Drive", "Exists")
Else
MsgBox(4096,"D: Drive", "Does NOT exists")
EndIf
donc pour votre exemple :
Code : Tout sélectionner
If FileExists("c:\Windows\Rapport") Then
MsgBox(4096, "c:\Windows\Rapport", "Exists")
Else
MsgBox(4096,"c:\Windows\Rapport" , "Does NOT exists")
EndIf
Re: [R] Commande équivalente à If FileExists pour un dossier ?
Posté : mar. 02 déc. 2008 21:45
par delvig
Merci beaucoup.
Patrice