首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >找不到子目录

找不到子目录
EN

Stack Overflow用户
提问于 2019-06-24 07:10:15
回答 1查看 136关注 0票数 0

我正在尝试在我的脚本中标识某个子目录模式。我得到的问题是目录没有被正确识别。下面是我当前的代码:

代码语言:javascript
复制
parentDir = '/data/home1/fL/user/path/to/subdirectories/'
totalFiles = subdir(fullfile(parentDir, '/*.7'));

name = {totalFiles.name}' % cells containing directories with the .7 ext this is a 118*1 cell
numTotalFiles=length(name); % =118

% this section is supposed to sort through all the subdirectories paths that
% have the pattern A_G/*.7 and p_G/*7 in their pathname but fails to do so. 

for i=1:numTotalFiles
  patternsplit = totalFiles(i).name
  str = ["*/A_G/*.7","*/p_G/*.7"]
  ptrn = ["A_G","p_G"]
  pattern = patternsplit(startsWith(str,ptrn))
  found = pattern
end

我希望输出是包含模式A_G/*.7p_G/*.7的子目录列表。我认为这可能是一个44x1的单元格,其中包含具有这些模式的所有子目录名称。

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56728336

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档