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

renamefile(filestruct,renamefilestring,fileext,dirname)
function renamefile(filestruct,renamefilestring,fileext,dirname)
% this function takes input as filerename string and renames those file
% with append data of number

%count = 0;
getfieldnames = fieldnames(filestruct);
filestruct = rmfield(filestruct,getfieldnames(end));
getfieldnames(end)= [];
dataprep = filestruct.(fileext);
for i = 1:size(dataprep,1)
    stringdata = strcat(renamefilestring,'_',num2str(i),'.',fileext);
    dataprep{i,2}=stringdata; %#ok<*SAGROW>
    dos(['rename "' strcat(dirname,'\',cell2mat(dataprep(i,1))) '" "',cell2mat(dataprep(i,2)), '"']);
end
 %cellfun(@(x) dos(['rename "' strcat(dirname,'\',x(:,1)) '" "',x(:,2), '"']),dataprep,'UniformOutput',false);
 
end

Contact us