Permalink
Cannot retrieve contributors at this time
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?
NMR_OPTIMA_BIDS/OPTIMA_check_BIDS.m
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
41 lines (35 sloc)
1.12 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |