Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
plotID_matlab
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
plotID
plotID_matlab
Merge requests
!60
Implements
#43
Code
Review changes
Check out branch
Open in Workspace
Download
Patches
Plain diff
Expand sidebar
Merged
Implements
#43
43-mehrfache-nachfrage-nach-suffix-bei-einer-dateioperation
into
development
Overview
0
Commits
1
Pipelines
1
Changes
1
Merged
Lemmer, Jan
requested to merge
43-mehrfache-nachfrage-nach-suffix-bei-einer-dateioperation
into
development
3 years ago
Overview
0
Commits
1
Pipelines
1
Changes
1
simplify and improve createFileCopy
Closes
#43 (closed)
0
0
Merge request reports
Compare
development
development (base)
and
latest version
latest version
fa62d60f
1 commit,
3 years ago
1 file
+
25
−
23
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
+PlotID/createFileCopy.m
+
25
−
23
View file @ fa62d60f
Edit in single-file editor
Open in Web IDE
Show full file
@@ -38,38 +38,40 @@ end
RemotePath
=
fullfile
(
storPath
,
folderName
,
newfile
);
% Check if remote file already exists
count
=
0
;
while
isfile
(
RemotePath
)
&&
ismember
(
type
,{
'data'
,
'dataCentral'
})
% Add a Sufix number to new file name
% TODO add more inteligent way then a simple sufix
count
=
count
+
1
;
[
~
,
name
,
ext
]
=
fileparts
(
RemotePath
);
if
count
<
2
RemotePath
=
fullfile
(
storPath
,
folderName
,
...
[
name
,
'_'
,
num2str
(
count
),
ext
]);
else
RemotePath
=
fullfile
(
storPath
,
folderName
,
...
[
name
(
1
:
end
-
length
(
num2str
(
count
))),
num2str
(
count
),
ext
]);
end
[
~
,
name
,
~
]
=
fileparts
(
RemotePath
);
if
isfile
(
RemotePath
)
&&
ismember
(
type
,{
'data'
,
'dataCentral'
})
% Add a Sufix number to new file name
[
~
,
name
,
ext
]
=
fileparts
(
RemotePath
);
msg
=
[
'Filename '
,
name
,
...
' already exists in the data folder'
newline
,
...
' PlotID will add an suffix if you continue.'
newline
,
...
' This can cause serious confusions.'
];
% User Dialog
msg
=
[
'Filename '
,
name
,
' already exists in the data folder'
newline
,
...
' PlotID will add an suffix if you continue.'
newline
,
...
' This can cause serious confusions.'
];
warning
(
msg
);
m
=
input
(
'Do you want to continue, Y/N [Y]:'
,
's'
);
if
ismember
(
m
,{
'N'
,
'n'
})
errorMSG
=
[
'Filename already exists in data folder.'
newline
,
...
' Rename the File and restart PlotID.'
];
error
();
end
end
error
(
errorMSG
);
end
% add sufix
RemotePath
=
fullfile
(
storPath
,
folderName
,
...
[
name
,
'_1'
,
ext
]);
% auto count until a sufix is reached that did not
% exist. (User is only asked once)
count
=
0
;
while
isfile
(
RemotePath
)
count
=
count
+
1
;
[
~
,
name
,
~
]
=
fileparts
(
RemotePath
);
RemotePath
=
fullfile
(
storPath
,
folderName
,
...
[
name
(
1
:
end
-
length
(
num2str
(
count
-
1
))),
num2str
(
count
),
ext
]);
end
end
%if
copyfile
(
FileNameAndLocation
,
RemotePath
);
storagePaths
{
i
}
=
RemotePath
;
end
end
%for
status
=
true
;
msg
=
([
type
,
' successfully published'
]);
% catch
Loading