I have used the adb shell command to shell into my android device.

I then tried to run the command...

touch -t 201108231405.14 *.png

To changed the modified time of all the files in the Photos directory of the device.

The error message I get is....

touch: invalid timestamp specified

What is wrong with the timestamp I am providing?

Trying the following command doesn't work and spits out the output...

touch: usage: touch [-alm] [-t YYYYMMDD[.hhmmss]] <file>


I have also tried this format and it didn't work...

1|shell@jfltecan:/sdcard/Pictures/ $ touch -t -c 20110823.140514 *png       
touch: invalid timestamp specified

I have also tried the following command which also did not modify the timestamp...

shell@jfltecan:/sdcard/Pictures/NYC $ touch -a -t 20110823.140514 *.png
touch: usage: touch [-alm] [-t YYYYMMDD[.hhmmss]] <file>
ouch -a -t 20110823.140514 IMG_2880.png                                       <
255|shell@jfltecan:/sdcard/Pictures/NYC $ ls -l IMG_2880.png
-rwxrwx--- root     sdcard_r 12462866 2017-09-04 14:39 IMG_2880.png
shell@jfltecan:/sdcard/Pictures/NYC $ 

As you see here touch -t creates the files before modifying the file.

touch -a    To change file access and modification time.
touch -m    It is used to only modify time of a file.
touch -r    To update time of one file with reference to the other file.
touch -t    To create a file by specifying the time.
touch -c    It does't create an empty file.

Another way would be :

touch -d '23 August 2011 14:05:14' *.png

-d, --date=STRING
              parse STRING and use it instead of current time
  • see edit to question. – Scorb Sep 4 '17 at 18:17

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.