I’m trying to ingest video files to a NAS. Some of them are very large (maybe several GB’s).
The app I’m creating gets unresponsive as soon as the copy starts but recovers nicely when the copy stops.
I’m wondering if my approach is wrong. Should I send the job to another (console) app or a shell or…?
In a window I’m having a timer with a period of 1000 updating a progress bar and this is the code in the thread that does the job:
[code]For i As Integer = 0 to Self.FilesToCopy
Self.SelectedFiles(i).CopyFileTo(CurrentFolder)
//We will get an error 80 if the file already exists so we will add the current time to the name
If SelectedFiles(i).LastErrorCode = 80 Then
Dim OldName, NewName, Extension, OldNameNoExtension, time As String
Dim n As Integer
Dim d As New Date
Dim f As FolderItem
OldName = SelectedFiles(i).Name
n = CountFields(OldName, ".")
Extension = NthField(OldName, ".", n)
OldNameNoExtension = Left(OldName, OldName.Len - Extension.Len + 1)
time = ReplaceAll(d.SQLDateTime, ":", "_")
NewName = OldNameNoExtension + "_" + time + "." + Extension
f = GetFolderItem(CurrentFolder.NativePath + NewName)
If f <> Nil Then
Self.SelectedFiles(i).CopyFileTo(CurrentFolder.Child(NewName))
End if
End if
Self.FilesCopied = i
App.YieldToNextThread
If Self.CancelCopyThread = True Then
Return
End if
Next[/code]