Skip to main content
Sign in
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 ...@@ -69,7 +69,7 @@ switch options.Method
sourcePath = fList.name{idx}; sourcePath = fList.name{idx};
createLinkedHDF5(sourcePath,storPath,ID); createLinkedHDF5(sourcePath,storPath,ID);
else % no identical file exists else % no identical file exists
createFileCopy(DataPaths.rdata,'data',storPath,ID,'dataCentral'); createFileCopy(DataPaths.rdata{i},'data',storPath,ID,'dataCentral');
end end
end end
case 'individual' case 'individual'
... ...
......
...@@ -3,6 +3,11 @@ function [] = createFileCopy(filePaths,folderName,storPath,ID,type) ...@@ -3,6 +3,11 @@ function [] = createFileCopy(filePaths,folderName,storPath,ID,type)
% folderName is the name of the exporting folder % folderName is the name of the exporting folder
disp(['start to copy ', type]); disp(['start to copy ', type]);
if ~iscell(filePaths)
%fixes Issue if Filepath is a char and not a cell array
filePaths = {filePaths};
end
% try % try
for i = 1:numel(filePaths) for i = 1:numel(filePaths)
FileNameAndLocation = filePaths{i}; FileNameAndLocation = filePaths{i};
...@@ -28,15 +33,15 @@ function [] = createFileCopy(filePaths,folderName,storPath,ID,type) ...@@ -28,15 +33,15 @@ function [] = createFileCopy(filePaths,folderName,storPath,ID,type)
% Write the file % Write the file
RemotePath = fullfile(storPath,folderName, newfile); RemotePath = fullfile(storPath,folderName, newfile);
% Check if remote file already exists (not working) % Check if remote file already exists
% count = 0; count = 0;
% while isfile(RemotePath) && ismember(type,{'data','dataCentral'}) while isfile(RemotePath) && ismember(type,{'data','dataCentral'})
% % Add a Sufix number to file name % Add a Sufix number to new file name
% count = count + 1; count = count + 1;
% [~,name,ext] = fileparts(RemotePath); [~,name,ext] = fileparts(RemotePath);
% RemotePath = fullfile(storPath,folderName,... RemotePath = fullfile(storPath,folderName,...
% [name,'_',num2str(count),ext]); [name,'_',num2str(count),ext]);
% end end
copyfile(FileNameAndLocation,RemotePath); copyfile(FileNameAndLocation,RemotePath);
end end
disp([type, ' sucessfully published']); disp([type, ' sucessfully published']);
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment