This commit is contained in:
Jonathan Jenne
2019-09-19 16:21:13 +02:00
parent 0ec5829275
commit f3a3812993
7 changed files with 85 additions and 11 deletions

View File

@@ -97,6 +97,23 @@ Public Class ImportZUGFeRDFiles
Dim oSource = GetOriginalEmailPath(Args.OriginalEmailDirectory, MessageId)
Dim oDestination = GetEmailPathWithSubjectAsName(Args.RejectedEmailDirectory, oEmailData.Subject)
Dim oVersion As Integer = 0
Dim oFileName As String = oDestination
Do While File.Exists(oFileName)
If oVersion > 29 Then
Throw New ApplicationException("Max. Move-Retries of 30 exceeded! Move will be aborted!")
End If
oVersion += 1
Dim oDestinationDir = Path.GetDirectoryName(oDestination)
Dim oExtension = Path.GetExtension(oFileName)
Dim oRootName = Path.GetFileNameWithoutExtension(oFileName)
Dim oNewName As String = oRootName & "~" & oVersion & oExtension
oFileName = Path.Combine(oDestinationDir, oNewName)
Loop
Try
File.Move(oSource, oDestination)
oEmailData.Attachment = oDestination