-
Notifications
You must be signed in to change notification settings - Fork 0
/
weed.m
53 lines (47 loc) · 1.37 KB
/
weed.m
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
function weed(cluster)
% Command-line dialog to confirm deletion of remote cluster folders marked
% for deletion by reaper.m
fprintf('\nThe following remote folders have been marked for deletion:')
for i=1:length(cluster)
if isfield(cluster{i},'tag_to_keep') && ~cluster{i}.tag_to_keep
try
fprintf('\n%10s in %s',cluster{i}.job{1}.result.variable_name,cluster{i}.id)
catch
fprintf('\n%10s in %s','',cluster{i}.id)
end
end
end
fprintf('\n\nThe following folders will be kept:')
for i=1:length(cluster)
if isfield(cluster{i},'tag_to_keep') && cluster{i}.tag_to_keep
try
fprintf('\n%10s in %s',cluster{i}.job{1}.result.variable_name,cluster{i}.id)
catch
fprintf('\n%10s in %s','',cluster{i}.id)
end
end
end
while 1
user_input = input('\n\nProceed? (y/n):','s') ;
switch user_input
case 'y'
weeder(cluster) ;
break
case 'n'
fprintf('leaving remote folder as is...\n\n') ;
break
otherwise
user_input = input('\nanswer: ''y'' or ''n''','s') ;
end
end
end
function weeder(c)
SET_ME_UP
for i=1:length(c)
if isfield(c{i},'tag_to_keep') && ~c{i}.tag_to_keep
xinu(sprintf( ...
'ssh %s@%s ''cd %s ; rm -rf %s''',...
user,server,root,c{i}.id)) ;
end
end
end