Jump to content

Photo file operations

From Costa's Wiki

Change date and time of file by it's name

[edit]

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