Mercurial > hg > camir-aes2014
comparison toolboxes/FullBNT-1.0.7/KPMtools/mkdirKPM.m @ 0:e9a9cd732c1e tip
first hg version after svn
author | wolffd |
---|---|
date | Tue, 10 Feb 2015 15:05:51 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:e9a9cd732c1e |
---|---|
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 |