From 4680df3e880be45c83a298002557fa6ac1b3a423 Mon Sep 17 00:00:00 2001 From: kaotisk Date: Sat, 20 Nov 2021 00:08:54 +0200 Subject: Packing to latest changes --- utils/01-migrate.sh | 13 +++++++++++++ utils/02-migrate_to_folder.sh | 19 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100755 utils/01-migrate.sh create mode 100755 utils/02-migrate_to_folder.sh (limited to 'utils') diff --git a/utils/01-migrate.sh b/utils/01-migrate.sh new file mode 100755 index 0000000..8b6db20 --- /dev/null +++ b/utils/01-migrate.sh @@ -0,0 +1,13 @@ +#!/bin/bash +echo "Migration tool: please run only once" +FILES=$(ls -1 | grep 202) +for file in $FILES; do + if [ -f $file ] + then + title="$(head -n 1 $file)" + new_name="$file-$(echo "$title" | tr '[:upper:]' '[:lower:]' | sed -e 's/ /\_/g')" + mv $file $new_name + git add $file $new_name + git commit -m "Migrated to new naming $file to $new_name"; + fi +done diff --git a/utils/02-migrate_to_folder.sh b/utils/02-migrate_to_folder.sh new file mode 100755 index 0000000..93e64f2 --- /dev/null +++ b/utils/02-migrate_to_folder.sh @@ -0,0 +1,19 @@ +#!/bin/bash +echo "Migration tool 2: please run only once" +echo "Moves your news to a news folder" +FILES=$(ls -1 | grep 202) +if [ -d news ] +then + echo "news directory exists"; +else + mkdir news; +fi +for file in $FILES; do + if [ -f $file ] + then + new_name="news/"$file + mv $file $new_name + git add $file $new_name + git commit -m "Moved $file to news folder"; + fi +done -- cgit v1.2.3