I want to log PDF files used to print, so I did this after creating 1.pdf :
B4X:
If File.Exists(File.DirInternal, "1.pdf") = True Then
File.Copy(File.DirInternal,"1.pdf",File.DirDefaultExternal,"Print-" & DateTime.Now & ".pdf")
End If
Original (1.pdf) is 21.91 KB
Copy (Print-1560764371069.pdf) is 39.13 KB
If File.Exists(File.DirInternal, "1.pdf") = True Then
Dim f As String = rp.GetSafeDirDefaultExternal("")
Log("safedir: " & f)
File.Copy(File.DirInternal,"1.pdf",F,"Printo-" & DateTime.Now & ".pdf")
But yet, the copy remains much bigger than the original.
Log(File.Size(File.DirDefaultExternal,"Print-" & DateTime.Now & ".pdf"))
Result - 0
My question was more of curiosity than anything. Like, for instance, the fact that the copy be bigger than the original could be due to the size of clusters, or something.
File.Copy will not change the file size. It is possible that you are seeing some other effect.
However it is difficult to say more based on the code you posted.
Dim SourceFile As String = "1.pdf"
Dim TargetFile As String = "Print-" & DateTime.Now & ".pdf"
If File.Exists(File.DirInternal, SourceFile) = True Then
File.Copy(File.DirInternal, SourceFile, File.DirDefaultExternal, TargetFile)
Log("Size of SourceFile: " & File.Size(File.DirInternal, SourceFile))
Log("Size of TargetFile: " & File.Size(File.DirDefaultExternal, TargetFile))
Else
Log("SourceFile doesn't exists")
End If
i think i have two reason.
the file was not overwritten, delete it first and be sure its gone.
if you look the files at pc, to not trust this virual file system. maybe reboot windows.