% obtain folder to restore backup from [pathname] = uigetdir('Select the source folder of the backup'); if(~pathname) return; end % define filename for the list of modified files filename = 'file_list.txt'; % define repos base repos_base = '/home/robocup/svn/trunk/src/Turtle2'; % store current path currentpath = pwd; %% open file and read the file list fid = fopen(fullfile(pathname,filename)); if(~fid) disp(['File : ',fullfile(pathname,filename),' not found']); end C = textscan(fid,'%s %s'); fclose(fid); files = C{2}; file_str = sprintf('Are you sure that you want to restore all these files?\n'); for k=1:length(files) file_str = sprintf('%s\n%s',file_str,files{k}); end choice = questdlg(file_str, 'File list','Yes','Cancel','Cancel'); if(strcmp(choice,'Yes')) disp(['Restoring all files']) for k=1:length(files) % split the filename because it includes the path lst = regexp(files{k}, '/', 'split'); fname = lst{end}; cmd = ['!cp ',fullfile(pathname,fname),' ',fullfile(repos_base,files{k})]; eval(cmd) disp(['Restoring : ',fullfile(repos_base,files{k})]); end end cd(currentpath)