Created
January 2, 2023 21:45
-
-
Save andredtr/42de65ff05a0a02f6ebfa26ad1841f7e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # usefull when importing notes from Notion. | |
| # Update the creation date of each .md file | |
| for file in *.md; do | |
| created=$(grep "Created" "$file") # created="Created: January 20, 2020 8:16 PM" | |
| # extract the date from the string | |
| date=${created#*: } # date="January 20, 2020 8:16 PM" | |
| # convert the date to a format that touch can understand | |
| formatted_date=$(date -j -f "%B %d, %Y %I:%M %p" "$date" "+%Y%m%d%H%M.%S") | |
| echo "$file: $formatted_date" | |
| touch -t "$formatted_date" "$file" | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment