Don't know really how to go about this? I can convert one tif to one pdf. I can convert all tifs in one directory into one pdf. What I want to do is convert a group of tifs based on their lastwriteaccess or createddate or modifieddate.
For example, if I have 7 tifs in one directory where 3 have the same timestamp and 4 have another same timestamp, I want to merge the 3 into one pdf then merge the other 4 into another pdf. I'm kind of stuck on how to approach this. Do I need to create list of all the files then group them or can I merge 3 then go the next group merge those etc, etc, etc using a for each?
The code below is what I'm using to collect the first 5 files:
Dim dir As New DirectoryInfo(tiffPath)
Dim files As List(Of FileInfo) =
dir.GetFiles("*.tif").OrderByDescending(Function(fc)
fc.LastAccessTime).Take(5).ToList
For Each lfi As FileInfo In files
MsgBox(lfi.Name)
Next
It looks like it would be sufficient to bunch files together if their timestamps differ by less than some timespan.
So, if you order the files by their
.LastWriteTimeUtcthen you can iterate over that list and check how long it was between one and the previous one. If the gap is small then add it to the current list, otherwise start a new list.I tested the following code on a directory with a random selection of files, so 30 days was an appropriate timespan for that, it looks like maybe two or three seconds would be good for your use:
I suggest two or three seconds because if the files have been stored on a FAT-type (e.g. FAT32 or exFAT, as can be used on USB memory sticks, old disk drives, and such) filesystem then the resolution of the timestamp will have been two seconds.