Last active
April 28, 2019 13:51
-
-
Save oripwk/40fcfe1497b677f86953c2ee811809df to your computer and use it in GitHub Desktop.
Restoring WhatsApp files timestamps after Google Drive restore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# when restoring WhatsApp in a new phone, all the timestamps of media files will be reset to today. | |
# this script will restore the original modification time of the files | |
cd WhatsApp/Media | |
while read path; do | |
f=$(basename "$path"); | |
touch -m -d "${f:4:4}-${f:8:2}-${f:10:2}T12:00:00z" "${path}"; | |
done < <(find . -regextype posix-extended -regex ".*/[[:alpha:]]{3}-[[:digit:]]{8}-.*") |
Hi,
It was a long time ago. But if I remember correctly, I copied the whole directory to my laptop, ran the script, and then copied it back to the Android phone using ADB.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @oripwk
Did you run this script on a mounted sd card?
I'm asking this because my WhatsApp folder is accessible on the phone only using either
adb shell
or MTP. MTP does not support changing the file date and the shell on the phone is incompatible with the syntax of the script and does not have regex support forfind
.