How do I change the modified date of a file, specifically PNGs, on Android without root?

Total Commander failed to do it with a permission error Access Denied.



You can simply touch the file or provide any time and date in past or future:

~$ touch /sdcard/test_file
~# debugfs -R 'stat media/0/test_file' /dev/block/bootdevice/by-name/userdata | grep crtime:
crtime: 0x5c926e0d:2d61b810 -- Wed Mar 20 21:45:01 2019
~$ touch -d '2009-2-13 14:32:55' /sdcard/test_file
~$ stat /sdcard/test_file
Access: 2009-02-13 14:32:55.000000000 +0000
Modify: 2009-02-13 14:32:55.000000000 +0000
Change: 2019-03-20 21:45:38.067021025 +0000
 Birth: -

Some file explorers like MiXplorer also have options to change Modified Time.
You don't need super user privileges to change mtime. Only the file should be writeable by your user ID (app in case of Android).


touch uses utimensat to update time of access (atime) and modification (mtime) provided that filesystem supports the timestamps be saved in inode along with file's data.

Birth/creation time (btime/crtime) - a part of extended file status which requires at least 256bytes inode size - is not standardized, thus rarely supported by filesystems. In above commands debugfs is used with root privileges to get creation time of file on ext4 because some stat binaries aren't updated to use statx yet (requires at least Linux Kernel 4.11), so btime is empty.

Both btime and change time (ctime; inode/metadata modification time) are supposed to be handled by system, not simply changeable by user.

Since Android is based on Linux, it inherits the concept of inode and timestamps from UNIX world. Common Linux filesystems like ext4 and f2fs support timestamps, including the emulated filesystems used by Android on SD cards. Other OS and filesystems have similar concept with slightly different terminologies. E.g. on Windows' NTFS, MFTEntry Modified time is very identical to UNIX's ctime.

  • touch -m wasn't working for me today where android phone is mounted using SSHFS on Ubuntu 16.04.6. However files copied to the phone OK. Most puzzling... Sep 20 '20 at 20:28
  • @WinEunuuchs2Unix that must be due to your SSHFS permissions (FUSE mount options). Android's emulated filesystem is quite tolerant. It even allows touch -d even if you are not the file owner (since all files in /sdcard are owned by root). On normal *NIX filesystems utimensat/utimes have strict permission requirements. Btw did you mount /sdcard or /data/media/0 on SSHFS? Sep 20 '20 at 20:57
  • This is most embarassing. Touch does work manually just not within my python program when file server touches phone. Touch phone to file server works. Grr three times I've run this two hour update over WiFi. Back to the drawing board. My Mount is: echo rick | sshfs -o auto_cache,reconnect,defer_permissions -o Ciphers=aes128-ctr -o Compression=no -o password_stdin -p 2222 rick@ /mnt/phone File server mount is different defaulting to port 22 and not nearly as complicated. Sep 20 '20 at 22:28
  • I spoke too soon. Manually touch -m .... the files on the SDCARD no longer appears to work either. Definitely have some homework to do. Sep 20 '20 at 23:17
  • It appears it's a bug in Android where you can't set the modification time. Not just my version 6 but even version 8:freefilesync.org/forum/viewtopic.php?t=4311 The only option is to root the phone but I'm going to change my program instead to not sync to Android devices based on modification time. Such a shame a Linux system got crippled by Google in this fashion. Sep 21 '20 at 1:06

Total Commander - file system - mark one or more files - long touch - properties - change the displayed date to what you need (there is also a "Now" button) - Save - voila !

BTW Total Commander is an excellent tool - in all areas and on all platforms !

  • Works great (Android 11)
    – Matt
    Oct 7 '21 at 8:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.