derez Expert Licensed User Longtime User Nov 21, 2014 #1 File explorer copies files without changing their "last modified" property, File.Copy does change it. Is there a way to copy a file without modifying its "last modified" property ? I've found this link showing how you can set this property in java http://examples.javacodegeeks.com/core-java/io/file/change-file-last-modified-date-in-java-example/ As a workaround I could copy the file and then set the time to the original time. Can someone show me how to use it with javaobject ? Last edited: Nov 21, 2014
File explorer copies files without changing their "last modified" property, File.Copy does change it. Is there a way to copy a file without modifying its "last modified" property ? I've found this link showing how you can set this property in java http://examples.javacodegeeks.com/core-java/io/file/change-file-last-modified-date-in-java-example/ As a workaround I could copy the file and then set the time to the original time. Can someone show me how to use it with javaobject ?
Erel B4X founder Staff member Licensed User Longtime User Nov 21, 2014 #2 Code: Copy Dim f As JavaObject f.InitializeNewInstance("java.io.File", Array(File.Combine(dir, filename)) f.RunMethod("setLastModified", Array(File.LastModified(original file))) Upvote 0
Code: Copy Dim f As JavaObject f.InitializeNewInstance("java.io.File", Array(File.Combine(dir, filename)) f.RunMethod("setLastModified", Array(File.LastModified(original file)))
derez Expert Licensed User Longtime User Nov 21, 2014 #4 For some reason it does not work on directories, any solution for that ? Actully the LastModified parameter is changed but the display still shows the creation time. I don't see a method to set the creation time. Edit: I think I know what the reason is - the time of the directory is updated with every new file that is written. I'll have to change the time after all files are there... to check tomorrow. Edit: Yes, this is it, problem solved. Last edited: Nov 22, 2014 Upvote 0
For some reason it does not work on directories, any solution for that ? Actully the LastModified parameter is changed but the display still shows the creation time. I don't see a method to set the creation time. Edit: I think I know what the reason is - the time of the directory is updated with every new file that is written. I'll have to change the time after all files are there... to check tomorrow. Edit: Yes, this is it, problem solved.