return_ext_file_in_dir - return file of specified extension in a directory presents in a tt_ml list
tt = return_ext_file_in_dir(tt_ml,dirn,ext)
- tt_ml : tt_ml master_list. (see return_master_list)
- dirn : string. name of directory to find in the tt_ml list
- ext : string. the extension of file to find in the tt_ml list
- tt : vector of strings. the list of the file names of extension ext
//return_ext_file_in_dir
//fonction qui cherche les fichiers d'extension ext
//dans un répertoire dir dans une liste principale
//Entrée : tt_ml : une liste principale (voir return_master_list)
// dirn : un vecteur de nom de répertoire
// ex : MODNUM+/macros
// ext : un vecteur chaîne d'extensions finales de fichier
// (ex ext='sci', ext='cos', mais aussi ext='monfichier.sci')
//Sortie : tt un vecteur de taille 1 contenant
// les noms de fichiers d'extension ext
function tt=return_ext_file_in_dir(tt_ml,dirn,ext)
if MSDOS then
dirn=pathconvert(dirn,%t,%t,'w')
else
dirn=pathconvert(dirn,%t,%t,'u')
end
//doit faire faire sur type of ext
a=length(ext(1))
tt=[];
p=size(tt_ml); //cherche dans toute l'arborescence
l=0
for i=1:p
for j=1:size(tt_ml(i)) //cherche dans tous les répertoires
if(tt_ml(i)(j)(1)==dirn(1)) then
for k=1:size(tt_ml(i)(j)(2),1) //uniquement les fichiers
tt_nam=tt_ml(i)(j)(2)(k);
if length(tt_nam)>(a-1) then
if part(tt_nam,length(tt_nam)-(a-1):length(tt_nam))==ext then
l=l+1;
tt=[tt;tt_ml(i)(j)(2)(k)];
end
end
end
break;
end
end
if tt<>[] then break, end;
end
//printf("Found %d file(s) with %s extension in %s\n",l,ext,dirn);
endfunction
IRCOM Group
Alan Layec