How can I save file's date&time?

Support for Android version of Total Commander

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
MaxX
Power Member
Power Member
Posts: 1029
Joined: 2012-03-23, 18:15 UTC
Location: UA

How can I save file's date&time?

Post by *MaxX »

Hi.
I need to move (or copy) some files from MicroSD to internal storage of my Android smartphone.
When I move (or copy) them, their original date&time is lost.
How can I save original file's date&time?

Android 7 on AGM A8 4/64 + Newest TC from Google Play.
Ukrainian Total Commander Translator. Feedback and discuss.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48079
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: How can I save file's date&time?

Post by *ghisler(Author) »

You can't because there is a bug in the function to set the time of a file. This was only fixed in Android 9.
Author of Total Commander
https://www.ghisler.com
User avatar
MaxX
Power Member
Power Member
Posts: 1029
Joined: 2012-03-23, 18:15 UTC
Location: UA

Re: How can I save file's date&time?

Post by *MaxX »

Is there any another way to set desired time/date?
Ukrainian Total Commander Translator. Feedback and discuss.
tag
Junior Member
Junior Member
Posts: 61
Joined: 2014-12-11, 11:03 UTC

Re: How can I save file's date&time?

Post by *tag »

TC is capable to circumvent the bug if having root.

You may also want have a look at my guide regarding the timestamp ;)
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48079
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: How can I save file's date&time?

Post by *ghisler(Author) »

I wouldn't root the device just for this bugfix. It can cause other problems like banking apps refusing to work etc.
Author of Total Commander
https://www.ghisler.com
User avatar
MaxX
Power Member
Power Member
Posts: 1029
Joined: 2012-03-23, 18:15 UTC
Location: UA

Re: How can I save file's date&time?

Post by *MaxX »

Hm. Is that possible on SD card without root?
Ukrainian Total Commander Translator. Feedback and discuss.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48079
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: How can I save file's date&time?

Post by *ghisler(Author) »

No it's not. The Android functions to write to SD-Card do not include a function to set the timestamp.
Author of Total Commander
https://www.ghisler.com
tag
Junior Member
Junior Member
Posts: 61
Joined: 2014-12-11, 11:03 UTC

Re: How can I save file's date&time?

Post by *tag »

It should be possible to put the sd card into an external device (for instance mobile router with card reader like RAVpower Filehub or Kingston MobileLite) that implements a samba server, and there set the timestamp via SAMBA, from the Android device (via copying or directly set the timestamp). Afterwards you can put the card back if wanted, or stay with the WLAN access.
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
Contact:

Re: How can I save file's date&time?

Post by *DrShark »

In Total Commander for Android date saving could be implemented by writing source files date data to <dirname>.lst file (DiskDir (Extended) compatible format) in dir to where files are copied/renamed.
File format seems to be good for this purpose, because it allows to store required file data, example:

Code: Select all

<file name 1>	<size>	<date>	<time>
<file name 2>	<size>	<date>	<time>
...
Then dates could be restored for such files when they are copied to PC with desktop TC using Change Attributes->From Target.
On Android device itself TC4A could prefer dates stored in .lst file if available, or show such dates in additional column or dialog.
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
Post Reply