Home > vbmeg > functions > gui > batch > vb_batch_job_mkdir.m

vb_batch_job_mkdir

PURPOSE ^

Make directories.

SYNOPSIS ^

function vb_batch_job_mkdir(dummy, mkdir_parm)

DESCRIPTION ^

 Make directories.
 [USAGE]
    vb_batch_job_mkdir(dummy, mkdir_parm);
 [IN]
         dummy : dummy field. This fields exists for
                 compatibility for other job functions.
    mkdir_parm : 
 [OUT]
    none

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function vb_batch_job_mkdir(dummy, mkdir_parm)
0002 % Make directories.
0003 % [USAGE]
0004 %    vb_batch_job_mkdir(dummy, mkdir_parm);
0005 % [IN]
0006 %         dummy : dummy field. This fields exists for
0007 %                 compatibility for other job functions.
0008 %    mkdir_parm :
0009 % [OUT]
0010 %    none
0011 %
0012 % Copyright (C) 2011, ATR All Rights Reserved.
0013 % License : New BSD License(see VBMEG_LICENSE.txt)
0014 
0015 %
0016 % --- Previous check
0017 %
0018 if ~exist('dummy', 'var')
0019     error('dummy is a required parameter.');
0020 end
0021 if ~exist('mkdir_parm', 'var')
0022     error('mkdir_parm is a required parameter.');
0023 end
0024 if ~isfield(mkdir_parm, 'directories')
0025     error('mkdir_parm should have a field named directories');
0026 end
0027 
0028 %
0029 % --- Main Procedure
0030 %
0031 directories  = mkdir_parm.directories;
0032 Ndirectories = length(directories);
0033 const = vb_define_verbose;
0034 
0035 for k=1:Ndirectories
0036     directory = directories{k};
0037     if ~isempty(directory)
0038         err_code = 1; %1=SUCCESS
0039         err_msg  = '';
0040         try
0041             err_code = vb_mkdir(directory);
0042         catch
0043             err_code = 0;
0044             err = lasterror;
0045             err_msg = err.message;
0046         end
0047             
0048         if err_code == 0
0049             % FAILURE
0050             vb_disp(...
0051              sprintf('''%s'' was NOT created.', directory), ...
0052              const.VERBOSE_LEVEL_WARNING);
0053         else
0054             vb_disp(...
0055              sprintf('''%s'' was created.', directory), ...
0056              const.VERBOSE_LEVEL_NOTICE);
0057         end
0058     end
0059 end
0060

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005