Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

Why doesn't Android keep track of the created and last accessed times as well as the last modified time for files in the file-system?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

It doesn't store creation time because UNIX filesystems (generally speaking) simply don't store this anywhere, and Android doesn't seem to be any different. This Stack Overflow question has some discussion about this fact (you can ignore the fact that it's talking about Python - the answers are still relevant), and the man page for stat describes what times are typically stored in the data structure.

As for the last accessed times...well it does keep track. Try ls -l in any directory you have proper permissions for:

$ cd /sdcard/
cd /sdcard/
$ ls -l
ls -l
drwxrwxr-x system   sdcard_rw          2011-04-27 14:31 LOST.DIR
drwxrwxr-x system   sdcard_rw          2011-04-27 14:31 DCIM
drwxrwxr-x system   sdcard_rw          2011-04-27 14:31 Android
drwxrwxr-x system   sdcard_rw          2011-04-27 16:14 glogs
-rwxrwxr-x system   sdcard_rw    49152 2011-05-27 16:04 AndroidBytes.txt
drwxrwxr-x system   sdcard_rw          2011-06-28 16:28 vim
-rwxrwxr-x system   sdcard_rw        0 2011-09-11 16:48 su-2.3.1-bin-signed.zip
$

If you have busybox you can also use the stat command for more detailed info. It also lets you use some additional ls flags like -u, -c and -t (see man ls if you're not familiar with it). Here's a sample from stat:

# stat databases
stat databases
  File: "databases"
  Size: 2048            Blocks: 4          IO Block: 4096   directory
Device: 1f06h/7942d     Inode: 454         Links: 1
Access: (0771/drwxrwx--x)  Uid: (10079/  app_79)   Gid: (10079/  app_79)
Access: 2011-09-29 09:07:44.000000000
Modify: 2011-09-29 09:07:44.000000000
Change: 2011-09-29 09:07:44.000000000
#
share|improve this answer
    
When using stat on a file on the sdcard one gets 'Uid: (0/root)' . –  IHeartAndroid Mar 23 at 18:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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