annotate _FullBNT/KPMtools/mkdirKPM.m @ 9:4ea6619cb3f5 tip

removed log files
author matthiasm
date Fri, 11 Apr 2014 15:55:11 +0100
parents b5b38998ef3b
children
rev   line source
matthiasm@8 1 function mkdirKPM(dname)
matthiasm@8 2 % function mkdirKPM(dname)
matthiasm@8 3 % If directory does not exist, make it
matthiasm@8 4 %
matthiasm@8 5 % mkdirKPM('foo\bar\baz') makes subdirectories bar and baz
matthiasm@8 6 % mkdirKPM('foo\bar\baz.txt') makes subdirectories bar
matthiasm@8 7
matthiasm@8 8 % convert foo\bar\baz to pathstr=foo\bar, name=baz
matthiasm@8 9 % convert foo\bar\baz.txt to pathstr=foo\bar, name=baz
matthiasm@8 10 [pathstr, name, ext, versn] = fileparts(dname);
matthiasm@8 11 if ~isempty(ext) % we stripped off something after final period
matthiasm@8 12 % convert foo\bar to pathstr=foo, name=bar
matthiasm@8 13 % convert foo\bar.bad to pathstr=foo, name=bar.bad
matthiasm@8 14 [pathstr, name, ext, versn] = fileparts(pathstr);
matthiasm@8 15 name = sprintf('%s%s', name, ext); % in case there is a period in the directory name
matthiasm@8 16 end
matthiasm@8 17
matthiasm@8 18 dname = fullfile(pathstr, name);
matthiasm@8 19 if ~exist(dname, 'dir')
matthiasm@8 20 %fprintf('mkdirKPM: making %s, %s \n', pathstr, name);
matthiasm@8 21 mkdir(pathstr, name)
matthiasm@8 22 else
matthiasm@8 23 %fprintf('mkdirKPM: %s already exists\n', dname)
matthiasm@8 24 end