Last active
February 10, 2026 11:24
-
-
Save silverzhaojr/fb3d79b419e3114544d34030cd7821b4 to your computer and use it in GitHub Desktop.
update photo modification date
This file contains hidden or 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
| # update photos from Camera | |
| for file in $(find . -type f -name 'IMG*' -o -name 'Screenshot*' -o -name 'VID*'); do timestamp=$(echo "$file" | sed -E 's,.*/?(IMG|Screenshot|VID)_([0-9]{8})[-_]([0-9]{4})([0-9]{2}).*.(jpg|png|mp4),\2\3.\4,') ; echo touch -t "$timestamp" "$file" ; touch -t "$timestamp" "$file" ; done | |
| # update pictures from Weixin | |
| for file in $(find . -type f -name 'mmexport*'); do timestamp=$(date +'%Y%m%d%H%M.%S' -d @$(echo "$file" | sed -E 's,.*/?mmexport(1[0-9]{9})([0-9]{3})\.jpg,\1,')) ; echo touch -t $timestamp "$file" ; touch -t "$timestamp" "$file" ; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment