Biomodèles/Biomodels
SCILAB 3.0 PAS A PAS
SCILAB 3.0 STEP-TO-STEP

Jacques-Deric Rouault

Laboratoire de Neurobiologie de l'Apprentissage, de la Mémoire et de la Communication. CNRS UMR 8620, Bat. 446, Université Paris-Sud, F91400 Orsay

Orscilab
ORSCILAB

30 LA GESTION DES FICHIERS
30 FILE MANAGEMENT
30.3 La liste des fichiers / The file list
Version 2.1.2 du 16 janvier 2005 / Version 2.1.2, January 16th 2005
Biomodèles/Biomodels N°1 pp 0x-0y Décembre 2004 December 2004

Retour à la Table générale / Return to the General table
Index général / General index
Passage à la section suivante 30.4 / Next section 30.4

a
dir
Ms-dos/Windows syntax
Syntaxe Ms-dos/Windows

b
ls
Syntaxe Unix

Unix syntax

c
listfiles

La fonction dir retourne sous la forme d'une liste de type tlist  la liste des fichiers contenus dans le répertoire spécifié et décrit selon la syntaxe Ms-dos/Windows.
The function dir returns the list of the files in a  directory specified following a Ms-dos/Windows syntax, under the form of a list tlist.

// PROGRAMME SPAS300301 dir
liste = dir ("C:\"),

Ch30Sc03-Fig01

On y trouve aussi bien les noms des fichiers que des répertoires. Utiliser la fonction isdir pour les différentier.
We can fin the names of the files as those of the directories. Use the function isdir to differentiate them.

La variable list comprend 3 champs : le nom list.name (chaine de caractères), la date list.date (entier représentant le nombre de secondes écoulées depuis le 1er janvier 1970) et la nature list.isdir (booléen). Chaque champ est un vecteur.
The variable list is compound with 3 fields : the name list.name (string of char), the date list.date (integer reprsenting the number of seconds ellapsed since January 1st 1970)  and the nature list.isdir (Boolean). Each field is a vector.

// PROGRAMME SPAS300302 dir
liste = dir ("C:\");
for i=1:size(liste) do
  printf ("%s  %s  %s \n ",liste.name, list.date, liste.isdir);
end;

Ch30Sc02-Fig02

Problème : le second champ est constant et égal à zéro, le troisième est constant et correspond à un fichier.
Problem: the second field is constant and corresponds to zero, the third fils is constant and corresponds to a file.

La fonction dir accepte les jockers de la syntaxe Ms-dos/Windows, par exemple *.
The function dir accepts the jokers ot the Ms-dos/Windows syntax, for instance *.

// PROGRAMME SPAS300303 dir
liste = dir ("C:\*.log"),

Ch30Sc03-Fig03

La fonction ls retrourne sous la forme d'une liste de type tlist  la liste des fichiers contenus dans le répertoire spécifié, selon la syntaxe  Unix.
The function ls returns the list of the files in a directory specified, following the Unix syntax, under the form of a list tlist.

// PROGRAMME SPAS300304 ls
liste = ls ("C:/"),

Ch30Sc03-Fig04

La fonction listfiles intègre les fonctions dir (avec la syntaxe Ms-dos/Windows) et ls (avec la syntaxe Unix).
The function listfiles integrates the functions dir (with the Ms-dos/Windows synatx) and ls (with the Unix syntax).

// PROGRAMME SPAS300305 listfiles
liste = listfiles ("C:\"),



tk_getdir tk_getfile tk_savefile xgetfile
basename listfiles pathconvert cd, chdir (conversion) dirname
fileparts
host unix unix_g unix_s unix_x unix_w


Retour à la Table générale / Return to the General table
Index général / General index
Passage à la section suivante 30.4 / Next section 30.4