Jump to content

Photo file operations: Difference between revisions

From Costa's Wiki
 
(One intermediate revision by the same user not shown)
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:<br>
-rwxr-xr-x 1 costa costa  8570292 Jan 26 13:33 IMG_20230126_133309.jpg
<span style="color:white;background-color:black">
-rwxr-xr-x 1 costa costa  8570292 Jan 26 13:33 IMG_20230126_133309.jpg<br>
-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
 
</span>
  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

Latest revision as of 09:17, 14 February 2023

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