Skip to content

Instantly share code, notes, and snippets.

@asperduti
Last active June 10, 2018 18:04
Show Gist options
  • Save asperduti/44bc861a628905474a7e5903ea2a8309 to your computer and use it in GitHub Desktop.
Save asperduti/44bc861a628905474a7e5903ea2a8309 to your computer and use it in GitHub Desktop.
Set date created/modified of a files in directory with the date in its name
for f in *.jpg; do filename=$(echo $f | cut -d'.' -f 1); date=$(echo $filename | cut -d'_' -f 2)$(echo $filename | cut -d'_' -f 3); date=$(echo $date | cut -c1-12);echo $date; touch -t $date "$f"; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment