aboutsummaryrefslogtreecommitdiff
path: root/blogarticledate
blob: 6eb73a162fc228c50ce6ffba0115189ab905b4d3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env bash

# resets blog articles file date to the date indicated
# in the article
postDir=/home/philip/web/articles/2025

mapfile -t postArray < <(ls -t "$postDir"/*.html)
for posts in "${postArray[@]}"; do
  post="$posts"
  postdate=$(grep -o '>.*</h5>' "$post" | sed 's/\(>\|<\/h5>\)//g')
  echo "$postdate"
  #[[CC]YY]MMDDhhmm[.ss]
  postdate="${postdate//-}0000"
  echo Date="$postdate"  
  echo Item="$post"
  touch -a -m -t "$postdate" "$post"
done