forked from tvajtay/Click
-
Notifications
You must be signed in to change notification settings - Fork 0
/
seqer.m
55 lines (49 loc) · 1.85 KB
/
seqer.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
54
55
function [] = seqer( start_directory )
%SEQER Identifies seq files and deletes them from the current and all
%sub-directories
% Usage: seqer('PATH TO DIRECTORY')
tstart = tic;
working_directory = cd;
function [fold_detect,file_detect] = detector(path)
cd(path)
b = dir();
files = dir('*.seq');
isub = [b(:).isdir];
nameFolds = {b(isub).name}';
nameFolds(ismember(nameFolds,{'.','..'})) = [];
fold_detect = size(nameFolds, 1);
file_detect = size(files, 1);
end
[fold,fil] = detector(start_directory);
if fil > 0
seqs = dir('*.seq');
delete(seqs.name);
elseif fil == 0
fprintf('No seq files in the start directory\n');
end
if fold > 0
target = [start_directory '\**\*.'];
fprintf('Scanning all subdirectories from starting directory, please wait\n');
D = rdir(target); %// List of all sub-directories
for k = 1:length(D)
currpath = D(k).name;
[~,fil] = detector(currpath);
fprintf('Checking %s for seq files\n', currpath);
if fil > 0
cd(currpath)
seqs = dir('*.seq');
delete(seqs.name);
end
end
finish = datestr(now);
fprintf('Seqer completed at %s\n', finish);
cd(working_directory);
telapsed = toc(tstart);
fprintf('Seqer ran for %.2f seconds\n', telapsed);
elseif fold == 0
finish = datestr(now);
fprintf('Seqer completed at %s\n', finish);
telapsed = toc(tstart);
fprintf('Seqer ran for %.2f seconds\n', telapsed);
end
end