Skip to content

Instantly share code, notes, and snippets.

@lionelyoung
Last active December 17, 2015 07:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lionelyoung/5574120 to your computer and use it in GitHub Desktop.
Save lionelyoung/5574120 to your computer and use it in GitHub Desktop.
Fix the creation and modified date for video files from Galaxy Note 2
#!/usr/bin/env bash
cd ../src || exit 1
for f in 20*_*.*; do
TIMESTAMP=${f%.*} # Remove extension
TIMESTAMP=`echo $TIMESTAMP | sed 's/_001$//'` # Remove _001 from *.3gp files
TIMESTAMP=`echo $TIMESTAMP | awk 'sub("..$", "")'` # Remove last two characters (seconds in the timestamp)
TIMESTAMP=`echo $TIMESTAMP | sed 's/_//'`
echo Setting $f to $TIMESTAMP
touch -mt $TIMESTAMP $f
touch -t $TIMESTAMP $f
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment