aboutsummaryrefslogtreecommitdiff
path: root/utils/03-migrate_datetime_to_epoch.sh
blob: c5c7312b0310733f6a739063614ec29949df8a6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/bash
FILES=$(ls -1 news)
for file in $FILES
do
	datetime_old=$(echo $file | cut -d '-' -f 1)
	date=$(echo $datetime_old | cut -d '_' -f 1)
	time=$(echo $datetime_old | cut -d '_' -f 2)
	datetime=$(echo $date ${time:0:2}:${time:2:2}:${time:4:2})
	newdatetime=$(date -u -d "${datetime}" +%s)
	title=$(echo $file | cut -d '-' -f 2)
	newfile=$newdatetime-$title
	mv news/$file news/$newfile
	git add news/$file news/$newfile
	git commit -m "Renamed $file to $newfile according to migration #03"
done