DIRWALK - Walk the directory tree

版本 1.1.0.0 (4.1 KB) 作者: Evgeny Pr
Generate the file names and dir names in a directory tree by walking the tree.
1.5K 次下载
更新时间 2011/7/10

查看许可证

Function generate the file names and directory names in a directory tree by walking the tree top-down. For each directory in the tree rooted at directory topPath. For each directory of tree you can call "Visitor Function" for files processing.

Using:
[pathNames, dirNames, fileNames] = dirwalk(topPath)
dirwalk(topPath, visitor)
[visitorOutput1, visitorOutput2, ..., visitorOutputN] = dirwalk(topPath, visitor)
[...] = dirwalk(topPath, visitor, visitorInput1, visitorInput2, ..., visitorInputN)

Example:
topPath = fullfile(matlabroot, 'toolbox', 'matlab', 'demos');

% Get files and dirs listing (default visitor)
[pathNames, dirNames, fileNames] = dirwalk(topPath);

% Call visitor function in each dir
dirwalk(topPath, @(y,x) disp(strcat(y, filesep, {x.name}')))

See help DIRWALK and TEST_DIRWALK for detailes examples.

引用格式

Evgeny Pr (2024). DIRWALK - Walk the directory tree (https://www.mathworks.com/matlabcentral/fileexchange/32036-dirwalk-walk-the-directory-tree), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2009b
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 File Operations 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.1.0.0

- Fixed bugs
- Added default visitor
- Deleted global variables
- Other improvements

1.0.0.0