Skip to content
Permalink
02f25a58e6
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
41 lines (35 sloc) 1.12 KB
function OPTIMA_check_BIDS(input_dir)
%
% check for existing BIDS directory structure
%
% this function checks if a subdirectory "BIDS" exists in the
% current subject's folder
%
% if yes, user will be asked for permission to overwrite
%
% file history:
% created M. Czisch & F. Binder 8.11.2017
% last 19.4.2019 M. Czisch
fprintf('checking for BIDS directories\n');
cd(input_dir)
current_dir = pwd;
if size(dir('*BIDS'),1)
fprintf('\n\nWARNING: subdirectory tmp_BIDS already exists\n');
prompt = 'should the old file be deleted? (y(es)/n(o)/c(ontinue)): ';
str = input(prompt,'s');
if strcmp(str,'y')
cmd_str = ['rm -rf ', current_dir, '/*BIDS']; system(cmd_str);
elseif strcmp(str,'c')
fprintf('\nCAVE: previous BIDS data might be overwritten\n');
prompt = 'Do you want to continue? y/n [n]: ';
str = input(prompt,'s');
if isempty(str)
str = 'n';
end
if ~strcmp(str,'y')
error('ERROR: programm terminates');
end
else
error('ERROR: old files will not be removed - programm terminates');
end
end