Scilab Function
eng


return_dir_name

File content


//tt une variable txt
//path un chemin
function tt=return_dir_name(path)
 tt=[];
 if MSDOS then
   if part(path,length(path))=='\' then
      path=part(path,1:length(path)-1);
   end
 end
 if fileinfo(path)<>[] then
   rep=pwd();
   chdir(path);

   if MSDOS then
     k=1;
     tt=[];
     str='ttf=unix_g(''dir /B /A:D'');';
     execstr(str,'errcatch');
     if ttf<>[] then
       for j=1:size(ttf,1)
         if isdir(ttf(j)) then 
           tt(k)=ttf(j); k=k+1;
         end
       end
     end

   else
     k=1;
     tt=[];
     str='ttf=unix_g(""ls"")';
     execstr(str,'errcatch');
     if ttf<>[] then
       for j=1:size(ttf,1)
         if isdir(ttf(j)) then 
           tt(k)=ttf(j); k=k+1;
         end
       end
     end
   end
 
  chdir(rep);
 end
endfunction