getfiles.m

버전 1.1.0.0 (6.7 KB) 작성자: Dan Nyren
Creates a list of files from optional file extensions and/or keywords in all folders and subfolders
다운로드 수: 400
업데이트 날짜: 2014/8/5

라이선스 보기

GETFILES Creates a list of files from optional file extensions and/or keywords in all folders and subfolders in current or supplied directory. NOTE: This code has not been evaluated on MAC OS machines and most likely will not work on them due to the system notation.
___________________________________
SYNTAX :
FileList=GETFILES(Input1,...,Input3)
________________________________________
INPUTS :
NOTE: Input order does not matter,however there can only be a maximum of 3 inputs.

File Keyword/Extension :
-Any File Extension in '*.*' format. If no file extension input is provided, output will be all files within specified directory.
-Keywords can also be provided to narrow search where asterisk (*) is a wildcard(example:
'*sample*.csv' will output all files ending in sample___.csv such as fastsample1.csv or sample0132.csv).
-Multiple filenames can be provided, separated by spaces (in the form '*.ext1 *.ext2' where all of the files of all of the extensions listed will be output.
-Any of the above can be combined to create large keyword/extension combinations.

Directory : Location of folder to search within. If no directory is provided, the current working directory will be used. NOTE: Supplying a directory will add that directory to the current working directory. To return to old directory,use CD.

Specific Files: Matrix used to select specific files from output list. If no matrix is provided entire list will be output.
________________________________________
EXAMPLES :

FileList=GETFILES;
Outputs a list of all the files in the current working directory.

FileList=GETFILES('*.csv');
Outputs a list of all of the *.csv (comma separated value) files in the current working directory.

FileList=GETFILES('*sample.csv');
Outputs a list of all of the files ending in sample.csv in the current working directory.

FileList=GETFILES('C:\Program Files\MATLAB\R2013a\licenses')
Outputs a list of all of the files in the licenses folder (and any subfolders) of the licenses folder in the MATLAB program files.

FileList=GETFILES([1,3:5,18])
Outputs files 1, 3, 4, 5, and 18 from the sorted list of the files in the current working directory.

FileList=GETFILES('*.txt', 'C:\Program Files\MATLAB\R2013a\',[4,18:20])
Ouputs *.txt files 4, 18, 19, and 20 from the R2013a folder (and any subfolders) of the MATLAB program files.
________________________________________
NOTES :

-Supplying a directory will add that directory to the current working directory

-Filename endings can also be provided to narrow search example: '*sample.csv' will output all files ending in sample.csv)

-Use UIGETDIR to interactively get directory path and pass it to GETFILES

-The first files in the list will generally be the files from the main folder selected

인용 양식

Dan Nyren (2024). getfiles.m (https://www.mathworks.com/matlabcentral/fileexchange/47459-getfiles-m), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2013a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 File Operations에 대해 자세히 알아보기
도움

줌: Find duplicate files

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
1.1.0.0

Updated notes in file.

1.0.0.0