TC-A 2.62 Request: preserve date/time stamp on copy.

Support for Android version of Total Commander

Moderators: Stefan2, white, sheep, Hacker

aboutblank
Junior Member
Junior Member
Posts: 7
Joined: 2014-11-11, 22:54 UTC

Post by *aboutblank » 2015-11-16, 03:12 UTC

ghisler(Author) wrote:You are right, it was a typo, sorry.
Thanks!

Rather than start a new topic, I will add to this current one:

I am using TC v. 2.62 for Android, and today copied a file from one folder, to another, successfully. However, I noted that the new file had a current date/time stamp, instead of the date/time of the original file. Is this normal behavior?

Under Windows, I regularly use the compare file function to insure that the copy of an important file is byte-for-byte identical to the original. Would it be possible to implement this function under Android, even if only to display whether the source and target are the same, without displaying the differences, as on Windows? (Such a function would have assured me that in the above scenario, the files were the same, despite the different date/time stamps.)

Thanks!

aboutblank
November 15, 2015

User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 37363
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) » 2015-11-16, 10:33 UTC

Yes, it's a well known Android bug, but Google refuses to fix it: It's not possible to set/copy the timestamp
of files on Android due to missing permissions of the user to set them. Only the root user is allowed to set/copy the timestamp.

Here are the relevant bug reports in the Android bug tracker:

File setLastModified always returns false
https://code.google.com/p/android/issues/detail?id=1992

setLastModified() always fails on Xoom unless running as root
https://code.google.com/p/android/issues/detail?id=18624

File.setLastModified() always returns false on Samsung Galaxy Nexus
https://code.google.com/p/android/issues/detail?id=25460
Author of Total Commander
http://www.ghisler.com

aboutblank
Junior Member
Junior Member
Posts: 7
Joined: 2014-11-11, 22:54 UTC

Post by *aboutblank » 2015-11-16, 10:50 UTC

ghisler(Author) wrote:Yes, it's a well known Android bug, but Google refuses to fix it: It's not possible to set/copy the timestamp
of files on Android due to missing permissions of the user to set them. Only the root user is allowed to set/copy the timestamp.
Thanks!

Any chance we might see a simplified compare function, as mentioned in my second paragraph?

aboutblank
November 16, 2015

User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 37363
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) » 2015-11-16, 10:52 UTC

I will consider it, it would be quite easy to implement.
Author of Total Commander
http://www.ghisler.com

aboutblank
Junior Member
Junior Member
Posts: 7
Joined: 2014-11-11, 22:54 UTC

Post by *aboutblank » 2015-11-16, 11:19 UTC

ghisler(Author) wrote:I will consider it, it would be quite easy to implement.
Many thanks, I will look forward to seeing it in the future!

aboutblank
November 16, 2015

User avatar
SkipR
Junior Member
Junior Member
Posts: 60
Joined: 2008-03-27, 10:39 UTC
Location: W. Australia

Post by *SkipR » 2017-01-28, 01:01 UTC

ghisler(Author) wrote:Yes, it's a well known Android bug, but Google refuses to fix it: It's not possible to set/copy the timestamp
of files on Android due to missing permissions of the user to set them. Only the root user is allowed to set/copy the timestamp.
I am puzzled I installed "ES File Explorer File Manager" app on Android 5.0.1 (no root access) and if I use the cut and paste or "move" file functions it preserves the date, "copy" function does not preserve date. Does that make any sense is there a trick to get around the problem that perhaps TC for android could use to implement "move" the same way? (Tested on internal SD card moving from Documents to Downloads)
Skip
Perth, AU

User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 37363
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) » 2017-01-30, 14:25 UTC

Moving files within the same partition of the flash memory does not modify the file, so the time stamp is preserved. The same should happen when you move files with Total Commander within /storage/emulated/0. It doesn't work with external SD-Cards though: They require special functions which only support renaming, not moving files.
Author of Total Commander
http://www.ghisler.com

DimitriJunker
Junior Member
Junior Member
Posts: 5
Joined: 2014-09-11, 16:50 UTC
Location: Aachen

Post by *DimitriJunker » 2017-03-03, 04:07 UTC

Hi,

If Android doesn't allows to set the date, than let's find other ways to get what we want. Most users who need this seem to need it for photo or video files. With some formats you can use the exif information instead, so you don't need the file date, but not all formats and cameras support it, specially video. But there is a way around it, an xmp file. So what I would like is that in the settings you can choose file types for which when copying them a xmp file should be created, if there isn't one already, which contains the original file date. If for legal or other reasons xmp is not possible just create an other file type. So the first step, not losing the information is done. A second step would be to allow the opposite direction, set the file date according to the xmp information, of course this will only work on systems where you can set it. But for example for my workflow:
Copy files from camera SD to smartphone and on to usb stick as a backup
Copy files from usb stick to pc for video editing
This would be enough. Instead of creating one xmp file for each file, you could also create some kind of log file containing all the information of the whole copy process

DimitriJunker
Junior Member
Junior Member
Posts: 5
Joined: 2014-09-11, 16:50 UTC
Location: Aachen

Post by *DimitriJunker » 2017-03-28, 01:01 UTC

I found part of the solution.
With the app shell terminal emulator I go to the source directory by using the cd command and then this:
ls -R -l >ls.txt
This creates a textile (ls.txt) with the listing. of the directory and it's subdirectories (-R) including all the information(-lj for reconstructing the date later under Windows our any other OS allowing to do that. If I need to reconstruct it or if someone asks me to do so I'll write a Windows program. I only use it as a backup, that's why I hopefully want need it. But I can't do it before end of May

tag
Junior Member
Junior Member
Posts: 59
Joined: 2014-12-11, 11:03 UTC

Post by *tag » 2017-03-28, 11:33 UTC

Please do not write a Windows program. Use some Perl, bash or Java or whatever you want so that it runs also using Unix, Mac and anywhere else - and can be run on Windows too.

Also it probably can be used later on Android 8/O, when sdcardfs allows to set timestamp (it should). Please also see my FAQ timestamp (German, English)

DimitriJunker
Junior Member
Junior Member
Posts: 5
Joined: 2014-09-11, 16:50 UTC
Location: Aachen

Post by *DimitriJunker » 2017-03-28, 12:00 UTC

I have to use a programming language I know, that would be C++ , but maybe there is someone else here to write it in one of the more global languages. Or I have a look in how to write plugins for total commander and do it that way. Do you need this tool? So let's see who needs it for which system and who is able to program it. It should be easy and I only return home on May 17

tag
Junior Member
Junior Member
Posts: 59
Joined: 2014-12-11, 11:03 UTC

Post by *tag » 2017-03-28, 12:50 UTC

I myself do not need this tool. If I see that a timestamp is wrong, I delete the copy with wrong timestamps and use a method which does copy the timestamp. My Android devices all are rooted for this reason (and for Titanium Backup). If I do not recognize that some timestamp is wrong, I am not aware that I now better should have done a listing of timestamps. But future users would be glad I guess if they don't need Windows to execute it. Android would be fine I guess. You copy from external OTG to internal memory, where timestamp can not be kept, and then later to some SAMBA share, where you can set timestamp.

If someone implements this, be careful if using bash (some examples/hints) or executing touch from some script language: the touch command which is being used to set timestamp exists with different syntax! toybox (Android) and Busybox (Android) and even different Busybox-versions may not implement some options, or implement it in different ways.

Dimitri, it may be a good experience for you if you want to exercise other languages than C++. I'm busy since quite some time with a similar project, generating m3u playlists in bash (executable on OS X, Android and Windows). But my spare time to implement is very rare, doing some lines of code a year.

Hammillian7
Junior Member
Junior Member
Posts: 76
Joined: 2003-07-16, 22:40 UTC
Location: Spain

Post by *Hammillian7 » 2017-05-01, 00:30 UTC

ghisler(Author) wrote:I will consider it, it would be quite easy to implement.
Oh, yeees, pleeease !

I miss it all the time. One of the things for which I use TC in android is managing (copying and moving) files (obviously for a file manager!) and comparing files (even with different dates) would be a most useful feature.

Thanks.
Thanks,
Jose

0so
New Member
New Member
Posts: 1
Joined: 2019-04-26, 03:45 UTC

Re:

Post by *0so » 2019-04-26, 04:06 UTC

ghisler(Author) wrote:
2015-11-16, 10:33 UTC
Yes, it's a well known Android bug, but Google refuses to fix it: It's not possible to set/copy the timestamp
of files on Android due to missing permissions of the user to set them. Only the root user is allowed to set/copy the timestamp.
I hate to sound obvious (and possibly even wrong) - but could it be possible to reset the system time before copying every file? I.e. ask for date/time setting permissions, disable getting time from internet, set time/date to first source file ones, copy, set time to second file, etc - and finally get time from internet again? Or this requires rooting, too?

tag
Junior Member
Junior Member
Posts: 59
Joined: 2014-12-11, 11:03 UTC

Re: TC-A 2.62 Request: preserve date/time stamp on copy.

Post by *tag » 2019-04-29, 08:47 UTC

You never know which app is doing its work in the background. Which licensecheck does check for invalid time. If a write operation gets blocked by some wait-for-access, you have a device running for a longer time with an invalid date-setting.

You understood that the problem is gone with Oreo and newer?

Post Reply