DIRR (find files recursively filtering name, date or bytes)

버전 1.0.0.0 (3.82 KB) 작성자: Maximilien Chaumon
Lists files recursively filtering name date and/or size. Output can be set as name date and/or size.
다운로드 수: 9.7K
업데이트 날짜: 2006/11/15

라이선스 보기

DIRR

Lists all files in the current directory and sub directories recursively.

[LIST] = DIRR(PATH)
Returns a structure LIST with the same fieldnames as returned by LIST = DIR(PATH)

PATH can contain wildcards * and ? after the last \ or / (filename filter)

The content of each directory in PATH is listed inside its 'isdir'field with the same format. The 'bytes' field is NOT zero but the sum of all filesizes inside the directory.

[LIST,BYTES] = DIRR(PATH)
BYTES is a structure with fields 'total' and 'dir'. 'total' is the total size of PATH. 'dir' is a recursive substructure that contains the same fields ('total' and 'dir') for the subdirectories.

[...] = DIRR(PATH,FILTER)
Lists only files matching the string FILTER (non case sensitive regular expression).

N.B.: FILTER is optional and must not be equal to a fieldname ('name' or 'date' ... will never be interpreted as filters)

[LIST,BYTES,FIELDOUT] = DIRR(PATH,FIELDIN, ...)
FIELDIN is a string specifying a field (of the structure LIST) that will be listed in a separate cell array of strings in FIELDOUT for every file with absolute path at the begining of the string.
Multiple fields can be specified.

[LIST,BYTES,FIELDOUT] = DIRR(PATH,FIELDIN,FILTER, ...)
Only files for which FIELDIN matches FILTER will be returned.

Multiple [FIELDIN, FILTER] couples can be specified. Recursion can be avoided here by setting 'isdir' filter to '0'. For bytes, numeric comparison will be performed.

EXAMPLES :

DIRR
Lists all files (including path) in the current directory and it's subdirectories recursively.

DIRR('c:\matlab6p5\work\*.m')

Lists all M-files in the c:\matlab6p5\work directory and it's subdirectories recursively.

Music = DIRR('G:\Ma musique\&Styles\Reggae\Alpha Blondy')

Returns a structure Music very similar to what DIR returns but containing the information on the files stored in subdirectories of 'G:\Ma musique\&Styles\Reggae\Alpha Blondy'.

The structure Music is a bit difficult to explore though.See next examples.

[Files,Bytes,Names] = DIRR('c:\matlab6p5\toolbox','\.mex\>','name')

Lists all MEX-files in the c:\matlab6p5\toolbox directory in the cell array of strings Names (including path). Note the regexp syntax of the filter string. Bytes is a structure with fields "total" and "dir". total is the
total size of the directory, dir is a recursive substructure with the same fields as bytes for the subdirectories.

[Files,Bytes,Names] = DIRR('c:\toto'...
,'name','bytes','>50000','isdir','0')

Lists all files larger than 50000 bytes NOT recursively.

[Files,Bytes,Dates] = DIRR('c:\matlab6p5\work','date','2005')

Lists all dates of files from year 2005. (With path in front of date in the cell array of strings Dates)

인용 양식

Maximilien Chaumon (2024). DIRR (find files recursively filtering name, date or bytes) (https://www.mathworks.com/matlabcentral/fileexchange/8682-dirr-find-files-recursively-filtering-name-date-or-bytes), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R14SP2
모든 릴리스와 호환
플랫폼 호환성
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.0.0.0

More reliable