-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathlsm.m
More file actions
39 lines (32 loc) · 986 Bytes
/
lsm.m
File metadata and controls
39 lines (32 loc) · 986 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
function lsm(parDir,varargin)
% list all the .m scripts in the 1st level subfolders
%
% Input:
% parDir --- parent path to list
% varargin --- specifing the extension
% Shiang Hu, Oct 9, 2021
% default listing file extension
ext = '*.m';
if ~isempty(varargin)
ext = varargin{1};
end
% listing parent path
if ~exist('parDir','var')
parDir=pwd;
end
files = dir(parDir); % Get a list of all files and folders in this folder .
dirFlags = [files.isdir]; % Get a logical vector that tells which is a directory.
subDirs = files(dirFlags); % Extract only those that are directories.
if ~isempty(dir([parDir,filesep,ext]))
[~,name] = fileparts(parDir);
display(upper(name));
ls(fullfile(parDir,ext));
end
for i=4:numel(subDirs) % ingnore .git
if ~isempty(dir(fullfile(parDir,subDirs(i).name,ext)))
display(upper(subDirs(i).name));
ls(fullfile(parDir,subDirs(i).name,ext));
end
end
display(parDir);
end