I'm trying to put in separate files .zip the images contained in file.dirrootexternal / pics / these .zip be more or less a function of the number of images.
Anyway, make several. Zip but always with the same images inside.
zip files. might not be over 3.6 Mb and and a maximum of 20 files within the .zip
Any ideas please?
thanks
Anyway, make several. Zip but always with the same images inside.
zip files. might not be over 3.6 Mb and and a maximum of 20 files within the .zip
Any ideas please?
thanks
B4X:
Sub imagenesrecibidas
If fo=1 Then
Try
Log ("entra a alas imagenes recibidas")
Dim List2 As List
List2.Initialize
Dim List3 As List
List3.Initialize
Dim fil As List
fil.Initialize
Dim dire As String
dire=File.DirRootExternal & "/pics/"
List2=File.ListFiles(dire)
If List2.Size=0 Then
Log ("no hay nada")
Return
End If
fil.AddAll(List2)
'Log(fil)
Dim fotolist(fil.Size) As String
'Log (n)
Log(fil.Size)
fil.Sort(False)
fil.RemoveAt(0)
List3.AddAll(fil)
'Log(List3)
Log(List3.Size)
'Do While aa<n
Dim cuantas As Int=List3.Size
Dim total As Int
If cuantas >20 Then
total=20
Else
total=cuantas
End If
Dim fotolist22(total) As String
Dim loto As Long
Dim a As Int
Dim ii As Int
For x=0 To cuantas/15
a=a+1
For pp= ii To total-1
fotolist(pp)=List3.Get(ii+pp)
Log(fotolist(pp))
Dim lo As Long
lo=File.Size(File.DirRootExternal&"/pics/",fotolist(pp))
If lo<3600000 Then
If loto<3600000 Then
loto=loto+lo
fotolist22(pp)= (fotolist(pp))
' Log(fotolist22(pp))
Log ("tamaño 1 "&File.Size(File.DirRootExternal&"/pics/",fotolist22(pp)))
'List3.RemoveAt(pp)
Else
If fotolist(pp).EndsWith("ent") Then
fotolist22(pp)="null"
End If
fotolist22(pp)="null"
End If
Else
fotolist22(pp)="null"
End If
ii=ii+1
Next
Try
Arc.AsyncZipFiles(File.DirRootExternal&"/pics/ Images/",fotolist22,File.DirRootExternal,"imagenesrecibido"&a&".zip","comprimir")
Log("tamaño "&File.Size(File.DirRootExternal&"/","imagenesrecibido"&a&".zip"))
Catch
End Try
smm.Initialize("smtp.gmail.com",465,funcio1&"@gmail.com",funcio2,"smtpp"&ii)
smm.UseSSL=True
smm.To.Add(funcio1&"@gmail.com")
smm.Subject="imagenes recibidos"&a
smm.Body="imagenes recibidos"
smm.AddAttachment(File.DirRootExternal,"imagenesrecibido"&a&".zip")
smm.Send
Next
Catch
End Try
End If
End Sub