Code covered by the BSD License  

Highlights from
Bulk File Rename

image thumbnail

Bulk File Rename

by

 

GUI Renames multiple files within a folder with same extension

getextension(dirname)
function [matrix AllFiles Directories rem] = getextension(dirname)
%GETEXTENSION Summary of this function goes here
%   Detailed explanation goes here

warning off all;
% dirname = pwd;
AllFiles = struct2cell(dir(dirname));
% AllFiles = struct2cell(dir(curdir));
AllFiles(:,1:2)=[]; % Remove .. & . directory details
AllFiles(2:3,:)=[]; % Remove other details of files
AllFiles(end,:)=[]; % Remove end row
% AllFiles(2:end,:)=[]; % Remove other details of files
AllFiles= AllFiles'; % get transpose
index = cell2mat(AllFiles(1:end,2));
% index = cell2mat(cellfun(@isdir,AllFiles,'UniformOutput',false));
Directories = AllFiles(index); % store directories
AllFiles(:,end)=[]; % Remove 2nd Col.
AllFiles(index)=[]; % Remove directories
[~, rem] = strtok(AllFiles,'.');
uniqueext = (strtok(unique(rem,'rows'),'.'))';
c=cell(1,size(uniqueext,2));
for i= 1:size(uniqueext,2)
    c{1,i}={};
end
Files= cell2struct(c,uniqueext,2);
matrix = fieldnames(Files);

end

Contact us