comparison toolboxes/FullBNT-1.0.7/KPMtools/mkdirKPM.m @ 0:cc4b1211e677 tip

initial commit to HG from Changeset: 646 (e263d8a21543) added further path and more save "camirversion.m"
author Daniel Wolff
date Fri, 19 Aug 2016 13:07:06 +0200
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:cc4b1211e677
1 function mkdirKPM(dname)
2 % function mkdirKPM(dname)
3 % If directory does not exist, make it
4 %
5 % mkdirKPM('foo\bar\baz') makes subdirectories bar and baz
6 % mkdirKPM('foo\bar\baz.txt') makes subdirectories bar
7
8 % convert foo\bar\baz to pathstr=foo\bar, name=baz
9 % convert foo\bar\baz.txt to pathstr=foo\bar, name=baz
10 [pathstr, name, ext, versn] = fileparts(dname);
11 if ~isempty(ext) % we stripped off something after final period
12 % convert foo\bar to pathstr=foo, name=bar
13 % convert foo\bar.bad to pathstr=foo, name=bar.bad
14 [pathstr, name, ext, versn] = fileparts(pathstr);
15 name = sprintf('%s%s', name, ext); % in case there is a period in the directory name
16 end
17
18 dname = fullfile(pathstr, name);
19 if ~exist(dname, 'dir')
20 %fprintf('mkdirKPM: making %s, %s \n', pathstr, name);
21 mkdir(pathstr, name)
22 else
23 %fprintf('mkdirKPM: %s already exists\n', dname)
24 end