help-octave
[Top][All Lists]
Advanced

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

Octave ;the scanfiles function below still finds deleted files and subdi


From: Patrick Pintelon
Subject: Octave ;the scanfiles function below still finds deleted files and subdir's; what's wrong? Thanks
Date: Wed, 18 Mar 2020 13:01:23 +0100
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0

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

reply via email to

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