-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDirectory.m
More file actions
34 lines (26 loc) · 1.03 KB
/
Directory.m
File metadata and controls
34 lines (26 loc) · 1.03 KB
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
classdef Directory
methods(Static)
function result = Exist(path)
result = exist(path, 'dir');
end
function Create(path)
if ~Directory.Exist(path)
mkdir(path);
end
end
function files = GetFiles(path)
entries = dir(path); %get list of files and folders in any subfolder
fileStructs = entries(~[entries.isdir]); %remove folders from list
for ind=1:length(fileStructs)
files{ind} = Path.Combine(fileStructs(ind).folder, fileStructs(ind).name);
end
end
function directories = GetDirectories(path)
entries = dir(path); %get list of files and folders in any subfolder
directoryStructs = entries([entries.isdir]); %remove folders from list
for ind=1:length(directoryStructs)
directories{ind} = char(directoryStructs(ind).folder);
end
end
end
end