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 Center および MATLAB AnswersFile 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