Created
September 17, 2014 23:42
-
-
Save tonyfast/709978c700a5a37ffdae to your computer and use it in GitHub Desktop.
Create a File Name List Recursively through a directory in matlab
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| d = cd | |
| paths = strsplit( genpath( d ), ':' ); | |
| fo = fopen( 'list.txt', 'w') | |
| for pp = 1 : numel( paths ) | |
| ff = dir( paths{ pp } ) | |
| [~,b] = fileparts(paths{pp}) | |
| if numel( ff ) > 0 & numel(strfind(paths{pp},'.git')) == 0 | |
| b = arrayfun( @(x)x.name(1)~='.' & ~logical( x.isdir), ff(:)) | |
| fprintf( fo, horzcat( paths{pp}, filesep,'%s\n'),ff(b).name); | |
| end | |
| end | |
| fclose(fo) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I had to make a few edits to get it to work for me. I can't seem to make a pull request so here is the url for my fork of this code: https://gist.github.com/awhite40/21a7d5d13f8e44ecd72c