Timestamp changed!! (root user)

Support for Android version of Total Commander

Moderators: white, Hacker, petermad, Stefan2

Post Reply
tad_u
Junior Member
Junior Member
Posts: 3
Joined: 2018-11-09, 00:41 UTC

Timestamp changed!! (root user)

Post by *tad_u »

Yesterday, I moved thousands of files from a directory to a newly created subdirectory, both on an external micro sd (I mean, it's in the phone, but not sdcard).
To my surprise, the timestamps of all files were changed to the time of moving the files.
I have root access and checked "root everywhere" in configurations. I don't remember this happening in the past.
Anyone know how this could happen?
Is there a way to get the original timestamps back?
I am kind of afraid of moving any files know.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Timestamp changed!! (root user)

Post by *ghisler(Author) »

Moving files between volumes (e.g. internal /storage/emulated/0 to SD card) means copying the data, and then deleting the originals. Unfortunately there is no function in regular Android to copy the timestamps. It is possible in root mode, but only to physical directories like /storage/emulated/0, not to virtual folders. Therefore timestamps are lost when copying/moving to SD cards if they are read only for regular apps. Since you have root, you should make Android mount the card so all apps can write to it.
Author of Total Commander
https://www.ghisler.com
tad_u
Junior Member
Junior Member
Posts: 3
Joined: 2018-11-09, 00:41 UTC

Re: Timestamp changed!! (root user)

Post by *tad_u »

Thank you for the explanation.
I am thinking, maybe I did not describe my "external micro sd" correctly.
I said "external" to separate it from "internal storage" which is /sdcard and also /storage/emulated/0.
But, this micro sd card IS inserted inside my phone and (I think) mounted at /storage/sdcard1 (Sony Xperia device).
Yes, the device is rooted, and I never experienced any apps having problem writing to /storage/sdcard1 and all its subdirectories.
I don't check every single time I copy or move files, but as far as I know timestamps are always preserved to and within /storage/sdcard1 (just tested and it is preserved through copying). That's why I am trying to understand what went wrong this time.

I had something like 5000 files in one directory, made 5 subdirectories under it, then moved about 1000 files into each of the subdirectories in chronological order. I am pretty sure I saw timestamps unchanged right after the move (since I was organizing the files according to timestamps), but few moments later (I was moving between the subdirectories to check if files were moved), I noticed all files had the current time now.

Do you know what could have caused it?
tag
Junior Member
Junior Member
Posts: 61
Joined: 2014-12-11, 11:03 UTC

Re: Timestamp changed!! (root user)

Post by *tag »

Access to sd card is different, dependent if you add /storage/longnumberwithdashes or ///_symbolicname. The symbolic one is managed in a special way by Android and CG explained some time ago there is no API for changing timestamp in this case. Android manages virtual folders, and timestamp can't be set. If you don't access using symbolic name, it should be fine.
tad_u
Junior Member
Junior Member
Posts: 3
Joined: 2018-11-09, 00:41 UTC

Re: Timestamp changed!! (root user)

Post by *tad_u »

OK, it has happen agained, or rather, it keeps happening pretty much regularly, but not 100% of the time. I really want to know what is causing this when it happens, and want to avoid such events.

Details:
I am moving files from one directory to another under /storage/sdcard1, which is a micro sd card inserted inside of the phone and mounted at the path.
My phone is rooted and I checked "root functions everywhere".
Timestamps are kept some of the times, but changed to the time of moving (copying) more often than not.
Timestamps APPEAR to stay unchanged 100% of the times when files are moved, but change to the time of copying SOME TIME LATER.
For example, let's say I have bunch of files dated 11/7. I move them to another directory today 12/11 at 12:30. After the move, timestamps still say 11/7. I go one level up in the directory tree, go to another directory, and 10 minutes later come back to the directory the files were moved to, to check if timestamps stayed unchagend, and indeed they are still 11/7. I move to another app, or simply go back to home screen, and set my phone aside for a few hours. Now, when I re-open Total Commander, say at 16:00, the timestamps of the moved files now say 12/11 12:30, time of copying.

How could this happen? Why the timestamps stay unchanged at the time of copying and several minutes (or even an hour) after that, but then change to the time of copying much later?
Post Reply