-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathsetpath.m
More file actions
66 lines (56 loc) · 2.17 KB
/
Copy pathsetpath.m
File metadata and controls
66 lines (56 loc) · 2.17 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
clear
fprintf('----------------------------------------------------------------------------------------------------\n');
currentMachine = computer('arch');
currentTime = datestr(now);
currentPath = pwd;
fprintf('Running on a %s machinen! Current path is %s\\ \n',currentMachine,currentPath);
fprintf('Setting paths...\n');
if ismac
seperator = '/';
elseif isunix
seperator = '/';
elseif ispc
seperator = '\';
else
disp('Platform not supported'); keyboard;
end
addpath([currentPath seperator]);
addpath([currentPath seperator 'c']);
addpath([currentPath seperator 'lib']);
addpath([currentPath seperator 'project']);
fprintf('----------------------------------------------------------------------------------------------------\n');
fprintf('Checking file changes...\n'); tic;
listing = dir([currentPath seperator]);
for ii = 3:length(listing)
if listing(ii).isdir
listing(ii).name = [pwd seperator listing(ii).name seperator];
else
listing(ii).name = [pwd seperator listing(ii).name];
end
end
fileNum = 0;
folderNum = 0;
while length(listing)>2
if listing(3).isdir
sublisting = dir(listing(3).name);
for ii = 3:length(sublisting)
if sublisting(ii).isdir
sublisting(ii).name = [listing(3).name sublisting(ii).name seperator];
else
sublisting(ii).name = [listing(3).name sublisting(ii).name];
end
listing = [listing; sublisting(ii)];
end
listing = [listing(1:2); listing(4:end)];
folderNum = folderNum + 1;
else
fprintf('%s\t%s\n',datestr(listing(3).datenum),listing(3).name);
listing = [listing(1:2); listing(4:end)];
fileNum = fileNum + 1;
end
end; et = toc;
pause(0.1);
fprintf('----------------------------------------------------------------------------------------------------\n');
fprintf('Totally %d files and %d folders are checked in %.2f seconds.\n',fileNum,folderNum,et);
fprintf('Time now is %s.\n',currentTime);
fprintf('----------------------------------------------------------------------------------------------------\n');