Skip to content
Snippets Groups Projects
Commit d5d196c8 authored by Lemmer, Jan's avatar Lemmer, Jan
Browse files

Closes #17

Fixes Error for single File copying
parent 4edd7e41
No related branches found
No related tags found
3 merge requests!13PreRelease_V0.1,!12PreRelease_V0.1,!1Add Link-replacement feature
......@@ -69,7 +69,7 @@ switch options.Method
sourcePath = fList.name{idx};
createLinkedHDF5(sourcePath,storPath,ID);
else % no identical file exists
createFileCopy(DataPaths.rdata,'data',storPath,ID,'dataCentral');
createFileCopy(DataPaths.rdata{i},'data',storPath,ID,'dataCentral');
end
end
case 'individual'
......
......@@ -3,6 +3,11 @@ function [] = createFileCopy(filePaths,folderName,storPath,ID,type)
% folderName is the name of the exporting folder
disp(['start to copy ', type]);
if ~iscell(filePaths)
%fixes Issue if Filepath is a char and not a cell array
filePaths = {filePaths};
end
% try
for i = 1:numel(filePaths)
FileNameAndLocation = filePaths{i};
......@@ -28,15 +33,15 @@ function [] = createFileCopy(filePaths,folderName,storPath,ID,type)
% Write the file
RemotePath = fullfile(storPath,folderName, newfile);
% Check if remote file already exists (not working)
% count = 0;
% while isfile(RemotePath) && ismember(type,{'data','dataCentral'})
% % Add a Sufix number to file name
% count = count + 1;
% [~,name,ext] = fileparts(RemotePath);
% RemotePath = fullfile(storPath,folderName,...
% [name,'_',num2str(count),ext]);
% end
% Check if remote file already exists
count = 0;
while isfile(RemotePath) && ismember(type,{'data','dataCentral'})
% Add a Sufix number to new file name
count = count + 1;
[~,name,ext] = fileparts(RemotePath);
RemotePath = fullfile(storPath,folderName,...
[name,'_',num2str(count),ext]);
end
copyfile(FileNameAndLocation,RemotePath);
end
disp([type, ' sucessfully published']);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment