Sub prtim_tick
proctimer.Enabled = False
Dim lof As List
lof.Initialize
lof = File.ListFiles( ecmFolder1 )
Log(ABMShared.CurrDT&" -- ECM Timer Check: "&lof.Size)
If lof.Size > 0 Then
Log(ABMShared.CurrDT& " how many new ecmfiles to process: "&lof.Size)
For i = 0 To lof.Size -1
Dim str As String
str = lof.Get(i)
If str.Contains(".zip") Then
PlaceinDir(str)
Exit ' process one file and wait for timer to tick again - 5 to 10 seconds, whatever I set it to...
End If
Next
End If
proctimer.Enabled = True
End Sub
Sub PlaceinDir(fn As String)
Dim str, str1 As String
Dim id, id1 As Int
str = fn
If str.Contains(".zip") Then
If File.Exists(ecmFolder1,str) Then
Dim arc1 As Archiver
id = str.IndexOf("_")
id1 = str.IndexOf(".")
str1 = str.SubString2(id+1,id1)
Log(" Folder to create: "&str1&" file got from: "&ecmFolder1)
Dim newfld As String = "TR_"&str1
File.MakeDir(ecmFolder,newfld)
File.MakeDir(base_ecm, "hist")
currdel = str
If arc.IsValidZipFile( ecmFolder1&"/"& str) Then
Log(" --- "&str&" is VALID zip")
' could not use ArchiverPlusZip UnZip... generated error looking for DoEvents!!!!!
'arc.UnZip(File.Combine( ecmFolder1,str), File.Combine( ecmFolder,newfld), "Archiver" )
arc1.AsyncUnZip(ecmFolder1, str, ecmFolder&"/"&newfld, "unzip")
Else
Log(" --- "& str&" is NOT VALID zip")
delzip(str)
End If
End If
End If
End Sub
Sub delzip(str As String)
Log(" File to delete: "&ecmFolder1&"/"&str)
File.Delete( ecmFolder1, str)
If (File.Exists(ecmFolder1,str)) Then
Log(ABMShared.CurrDT&" File WAS NOT deleted: "&ecmFolder1&"/"&str)
Else
Log(ABMShared.CurrDT&" File WAS Deleted!!!: "&ecmFolder1&"/"&str)
End If
End Sub