Skip to content

Instantly share code, notes, and snippets.

@oripwk
Last active April 28, 2019 13:51
Show Gist options
  • Save oripwk/40fcfe1497b677f86953c2ee811809df to your computer and use it in GitHub Desktop.
Save oripwk/40fcfe1497b677f86953c2ee811809df to your computer and use it in GitHub Desktop.
Restoring WhatsApp files timestamps after Google Drive restore
# 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}-.*")
@oripwk
Copy link
Author

oripwk commented Apr 28, 2019

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