help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Octave ;the scanfiles function below still finds deleted files and s


From: Steph Bredenhann
Subject: Re: Octave ;the scanfiles function below still finds deleted files and subdir's; what's wrong? Thanks
Date: Wed, 18 Mar 2020 17:07:48 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1

On 2020/03/18 14:01, Patrick Pintelon via Help-octave wrote:
function [dwnPath]=scanFiles(initialPath, extensions, fileHandler)

  persistent total = 0;
  persistent depth = 0; depth++;
  initialDir = dir(initialPath);
  persistent fff=cell(100,1);
  printf('dir SCAN: %s ...\n', initialPath);

  for idx = 1 : length(initialDir)
    curDir = initialDir(idx);
    curPath = strcat(curDir.folder, '\', curDir.name);

    if regexp(curDir.name, "(?!(\\.\\.?)).*") * curDir.isdir
    
      
      scanFiles(curPath, extensions, fileHandler);
    elseif regexp(curDir.name, cstrcat("\\.(?i:)(?:", extensions, ")$"))
     
      
      total++;
      file = struct("name",curDir.name,
                     "path",curPath,
                     "parent",regexp(curDir.folder,'[^\\\/]*$','match'),
                     "bytes",curDir.bytes);
      if (!isempty(file.path))
      
                fff(total)=file.path  ;
      endif  
      fileHandler(file);% hier beperkt tot displayen
    endif
  end

  if!(--depth)
    printf('Total number of files:%d\n', total);
    dwnPath=fff;
    total=0;
  else
    dwnPath=fff;
  endif
endfunction


    

I would like to test your function, please give an exampple on how you initialize the arguments initialPath, extensions, fileHandler

thanks

--
Steph


reply via email to

[Prev in Thread] Current Thread [Next in Thread]