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

Différence entre versions

De MappingDoc
(Page créée avec « To check the presence of a directory, you must go through a param box in cmd and use a shell which returns yes if the directory exists and no otherwise. »)
(Page créée avec « Script content: »)
Ligne 10 : Ligne 10 :
 
To check the presence of a directory, you must go through a param box in cmd and use a shell which returns yes if the directory exists and no otherwise.
 
To check the presence of a directory, you must go through a param box in cmd and use a shell which returns yes if the directory exists and no otherwise.
  
Contenu du script : 
+
 
 +
Script content:
  
 
  FOLDER=$1 
 
  FOLDER=$1 

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)


To check the presence of a directory, you must go through a param box in cmd and use a shell which returns yes if the directory exists and no otherwise.


Script content:

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