ONYX - 9.0 - KB - ifFileExist - Différence de comportement entre Windows et Linux/en

Différence entre versions

De MappingDoc
(Page créée avec « A difference in behavior on the ifFileExist box between Windows and Linux: »)
(Page créée avec « On Windows, this checks the presence of a file AND a directory.</br> On Linux, this just checks for the presence of a file (It does not return true if a directory is chec... »)
Ligne 3 : Ligne 3 :
 
A difference in behavior on the ifFileExist box between Windows and Linux:
 
A difference in behavior on the ifFileExist box between Windows and Linux:
  
Sur windows, celle-ci vérifie la présence d'un fichier ET d'un répertoire.</br>
+
 
Sur Linux, celle-ci vérifier juste la présence d'un fichier (Elle ne retourne pas vrai si un répertoire est vérifié) 
+
On Windows, this checks the presence of a file AND a directory.</br>
 +
On Linux, this just checks for the presence of a file (It does not return true if a directory is checked)
  
 
Pour vérifier la présence d'un répertoire, il faut passer par une boite param en cmd et utiliser un shell qui retourne yes si le répertoire existe et no sinon. 
 
Pour vérifier la présence d'un répertoire, il faut passer par une boite param en cmd et utiliser un shell qui retourne yes si le répertoire existe et no sinon. 

Version du 8 janvier 2025 à 08:33

Autres langues :
English • ‎français

A difference in behavior on the ifFileExist box between Windows and Linux:


On Windows, this checks the presence of a file AND a directory.
On Linux, this just checks for the presence of a file (It does not return true if a directory is checked)

Pour vérifier la présence d'un répertoire, il faut passer par une boite param en cmd et utiliser un shell qui retourne yes si le répertoire existe et no sinon. 

Contenu du script : 

FOLDER=$1 
if [ -d $FOLDER ]; then
echo "yes"
else
echo "no"
fi

  Appel du script dans la boite cmd :  

"[%PATH_BIN%]/custom/iffolderexist.sh" "[%PATH%]/../toto"

Avec "[%PATH%]/../toto"  le répertoire à vérifier.

PS : Le chemin relatif est possible via les /../ par exemple