aboutsummaryrefslogtreecommitdiff
path: root/utils/03-migrate_datetime_to_epoch.sh
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.com>2021-12-20 06:26:15 +0200
committerkaotisk <kaotisk@arching-kaos.com>2021-12-20 06:26:15 +0200
commit7ffdfa21846e127c1702b3194eaf3b1e10688eeb (patch)
tree77501b2ab91de277d0a0c0995974af521442ef07 /utils/03-migrate_datetime_to_epoch.sh
parent53007d4517665686f57bcc5dbfc14df06a3df97d (diff)
download01-NEWS-7ffdfa21846e127c1702b3194eaf3b1e10688eeb.tar.gz
01-NEWS-7ffdfa21846e127c1702b3194eaf3b1e10688eeb.tar.bz2
01-NEWS-7ffdfa21846e127c1702b3194eaf3b1e10688eeb.zip
Migration #03 - Converted datetime to epoch format in UTC
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