Copy File/Files action and lastModified time

Post your questions and help other users.

Moderator: Martin

Post Reply
anuraag
Posts: 371
Joined: 24 Jan 2015 02:06

Copy File/Files action and lastModified time

Post by anuraag » 29 Mar 2019 23:37

Hi Martin
Currently Copy File/Files action don't preserve source file's lastModified time. Instead it sets current time. Please fix it.

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Copy File/Files action and lastModified time

Post by Desmanto » 30 Mar 2019 01:43

As I know, this is android limitation. To preserve the time stamp, you have to use root. Some file manager (MiXplorer) use "touch" to keep the time stamp. You can use MiXplorer copy action to keep it.

All Automagic copy/move/init file and similar I/O action seems to be executed using normal user privellege, so can't use any root related action. Have to use root command version instead, example : cp, mv, ls, cat.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

anuraag
Posts: 371
Joined: 24 Jan 2015 02:06

Re: Copy File/Files action and lastModified time

Post by anuraag » 30 Mar 2019 02:07

What do you mean by *touch* to keep?

Edit: Do you mean "Last modified time" setting of MiXplorer?
Some file managers preserving last modified time. I think they are using setLastModified method to preserve lastModified time. I have tested it in automagic and it works.
I have tried cp without root. It preserves lastModified time for internal storage. For external storage it don't work.

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Copy File/Files action and lastModified time

Post by Desmanto » 01 Apr 2019 10:07

touch in terminal emulator command. It can be used to modify the timestamp after copy. So there is java equivalent to do it. Since it can be done without root, then there should be checkbox to preserve the timestamp for copy/move file actions.

For external storage, it seems the command should be passed thru the document provider. Same as the OTG flashdisk/harddisk or any external storage.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Copy File/Files action and lastModified time

Post by Martin » 01 Apr 2019 12:39

Hi,

The next update should preserve the last modified time when possible (on internal storage when Android allows to).
Not yet sure if this will work on external storage but I'll investigate.

Regards,
Martin

anuraag
Posts: 371
Joined: 24 Jan 2015 02:06

Re: Copy File/Files action and lastModified time

Post by anuraag » 01 Apr 2019 12:42

@Martin i have tested that java method setLastModified on external storage. It works.

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Copy File/Files action and lastModified time

Post by Martin » 01 Apr 2019 13:01

Maybe we mean the same thing. External storage is sometimes named internal storage. I mean I have to investigate if it's possible when file access has to be done with the storage access framework and not via classic File class.

Post Reply