Code covered by the BSD License  

Highlights from
Files to folders based on properties

image thumbnail

Files to folders based on properties

by

 

Groups files into folders based on user defined file properties.

files2filePropsFoldersDemo.m
fprintf('\n################################################\n');
fprintf('files2filePropsFolders DEMO\n');

fileNamesList=cat( 1, folderFiles(pwd), {'peppers.png'}, {'rhinos'} );
foldersList=files2filePropsFolders('inputsList', fileNamesList,...
    'targetFileProp', 'Height', 'fileOp', @copyfile);
fprintf('\t\tNew Folders\n');
for iFolder=1:numel(foldersList)
    fprintf('\nFolder "%s" files:\n', foldersList{iFolder});
    filesCell=cellstr( ls(foldersList{iFolder}) );
    isFolder=( cellfun(@isdir, filesCell, 'UniformOutput', false) );
    filesCell=filesCell( not(cat( 2, isFolder{:} )) );
    fprintf( '\t%s\n', filesCell{:} );
end

fprintf('\nThe files ordering to folders is done.\nSee relevant folders\n');
fprintf('Type "return" followed by "Enter" to finish the demo.\n');
keyboard;

fprintf('\nCleaning up the mess, removing created directories\n');
[status, message, messageid] = cellfun( @rmdir, foldersList,...
    repmat({'s'}, size( foldersList )), 'UniformOutput', false );

Contact us