Photo file operations: Difference between revisions
Appearance
| Line 1: | Line 1: | ||
=== Change date and time of file by it's name === | === Change date and time of file by it's name === | ||
like: | like: | ||
-rwxr-xr-x 1 costa costa 8570292 Jan 26 13:33 IMG_20230126_133309.jpg | -rwxr-xr-x 1 costa costa 8570292 Jan 26 13:33 IMG_20230126_133309.jpg | ||
-rwxr-xr-x 1 costa costa 8409903 Jan 26 13:33 IMG_20230126_133313.jpg | -rwxr-xr-x 1 costa costa 8409903 Jan 26 13:33 IMG_20230126_133313.jpg | ||
ls IMG* |while read -r rdate; do d=`echo $rdate | awk -F "_" '{print $2$3}' | sed 's/.jpg//g' | sed -E 's/(....)(..)(..)(..)(..)(..)/\1\/\2\/\3 \4:\5:\6/'`; touch -d"$d" $rdate ; done | ls IMG* |while read -r rdate; do d=`echo $rdate | awk -F "_" '{print $2$3}' | sed 's/.jpg//g' | sed -E 's/(....)(..)(..)(..)(..)(..)/\1\/\2\/\3 \4:\5:\6/'`; touch -d"$d" $rdate ; done | ||
Revision as of 20:26, 11 February 2023
Change date and time of file by it's name
like:
-rwxr-xr-x 1 costa costa 8570292 Jan 26 13:33 IMG_20230126_133309.jpg -rwxr-xr-x 1 costa costa 8409903 Jan 26 13:33 IMG_20230126_133313.jpg
ls IMG* |while read -r rdate; do d=`echo $rdate | awk -F "_" '{print $2$3}' | sed 's/.jpg//g' | sed -E 's/(....)(..)(..)(..)(..)(..)/\1\/\2\/\3 \4:\5:\6/'`; touch -d"$d" $rdate ; done