When you use File.Copy (or File.Copy2) it changes the last modified date of target file. I found this code posted by Erel to set the date manually.
Dim f As JavaObject
f.InitializeNewInstance("java.io.File", Array(File.Combine(dir, filename))
f.RunMethod("setLastModified", Array(File.LastModified(original file)))
While it works, the file I am trying to modify is on external SD card and there is no permission to modify a file on external SD directly. It can be done only using android.intent.action.OPEN_DOCUMENT_TREE intent that returns URI and not physical path. And copying a file to external SD card itself is a pain but that has been
solved here.
So the question is how to preserve (or manually set) the last modified date of a file when the file is accessed only via URI (like content://com.android.externalstorage.documents/tree/17FC-3214%3Atff)? It is somehow possible because when you copy a file using third party file managers, it preserves the date.