-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreplace_angles.ijm
48 lines (44 loc) · 1.16 KB
/
replace_angles.ijm
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
// dir = getDirectory("Choose a Directory ");
dir = getArgument();
count = 0;
countFiles(dir);
n = 0;
processFiles(dir);
//print(count+" files processed");
function countFiles(dir) {
list = getFileList(dir);
for (i=0; i<list.length; i++) {
if (endsWith(list[i], "/"))
countFiles(""+dir+list[i]);
else
count++;
}
}
function processFiles(dir) {
list = getFileList(dir);
for (i=0; i<list.length; i++) {
if (endsWith(list[i], "/"))
processFiles(""+dir+list[i]);
else {
// showProgress(n++, count);
path = dir+list[i];
deleteFiles(path);
}
}
}
function deleteFiles(path) {
delpath = newArray();
if (matches(path, ".*overall_tips_Angle_results.*")) {
delpath = Array.concat(delpath, path);
}
for (i=0; i<delpath.length;i++) {
tipspath = delpath[i];
// print(tipspath);
deletepath(tipspath);
}
}
function deletepath(tipspath) {
if (File.exists(tipspath)) {
File.delete(tipspath);
}
}