Skip to content

Instantly share code, notes, and snippets.

@tcarreira
Created August 15, 2023 12:56
Show Gist options
  • Save tcarreira/dafb338cca57ad657a3e54162007a900 to your computer and use it in GitHub Desktop.
Save tcarreira/dafb338cca57ad657a3e54162007a900 to your computer and use it in GitHub Desktop.
rename every video file with timestamp from metadata
# oneliner:
ls videos | xargs -I{} sh -c 'cp "videos/{}" $(exiftool -createdate -S "videos/{}" | cut -d " " -f2- | sed "s/[: ]//g")_$(printf "%05d.mp4" $RANDOM)'
# ### script mode:
# for video in $(ls videos/); do
# createdate=$(exiftool -createdate -S "videos/${video}" | cut -d " " -f2- | sed "s/[: ]//g")
# fname=$(printf "%s_%05d.mp4" ${createdate} ${RANDOM})
# cp "videos/$video" "$fname"
# done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment