Sachin J
Sachin J

Reputation: 2191

Using ADB : How to get file modification date command

I have following command to get file date with time

adb shell ls -l /sdcard/sample.txt
Result of this command :
-rwxrwxr-x system   sdcard_rw      676 2013-09-24 11:23 sample.txt

Now, I want 2013-09-24 11:23 time with seconds as well. like 2013-09-24 11:23:11

How I will get file modification date including seconds.

Thanks.. :)

Upvotes: 2

Views: 6409

Answers (3)

Mohamed
Mohamed

Reputation: 9

By tweaking the code posted, I was able to get it worked using this command :

adb -d shell ls -l time-style="+%Y-%m-%d %H:%M:%S" path_to_file_in_device

The output is :

-rw-rw-r-- root     sdcard_rw 22357385 2013-09-25 22:42 launcher.apk

Upvotes: 0

user2795605
user2795605

Reputation: 47

ls -l --time-style="+%Y-%m-%d %H:%M:%S" /sdcard/sample.txt

Upvotes: -2

konsolebox
konsolebox

Reputation: 75488

If you have a stat command:

stat -c %y /sdcard/sample.txt

Seconds since Epoch

stat -c %Y /sdcard/sample.txt

Upvotes: 6

Related Questions