aboutsummaryrefslogtreecommitdiff
path: root/utils/03-migrate_datetime_to_epoch.sh
diff options
context:
space:
mode:
Diffstat (limited to 'utils/03-migrate_datetime_to_epoch.sh')
-rwxr-xr-xutils/03-migrate_datetime_to_epoch.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/utils/03-migrate_datetime_to_epoch.sh b/utils/03-migrate_datetime_to_epoch.sh
new file mode 100755
index 0000000..c5c7312
--- /dev/null
+++ b/utils/03-migrate_datetime_to_epoch.sh
@@ -0,0 +1,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