From 3de17747c64de9ef08c6b7701434fa7bbd0047f8 Mon Sep 17 00:00:00 2001 From: Jeff LANCE Date: Fri, 8 Mar 2024 18:19:40 +0100 Subject: [PATCH] Add home/.config/ranger/scripts/dotify.sh --- .../ranger/scripts/executable_dotify.sh | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 home/dot_config/ranger/scripts/executable_dotify.sh diff --git a/home/dot_config/ranger/scripts/executable_dotify.sh b/home/dot_config/ranger/scripts/executable_dotify.sh new file mode 100644 index 0000000..1b7aedd --- /dev/null +++ b/home/dot_config/ranger/scripts/executable_dotify.sh @@ -0,0 +1,27 @@ +#!/bin/env bash + +# File : conf.d/ranger/scripts/dotify.sh +# Author : Jeff Lance +# Date : 01.10.2023 19:06:09 +# Last Modified Date: 01.10.2023 19:06:09 +# Last Modified By : Jeff Lance +# +# Script that alter visibility of a set of selected files. +# It renames files prefixing a dot in the name. + + + +for path in "$@"; do + file_name="$(basename "$path")" + dir_name="$(dirname "$path")" + case "$file_name" in .*) + mv -v -- "$path" "$dir_name/${file_name#.}" + ;; + *) + mv -v -- "$path" "$dir_name/.$file_name" + ;; + esac +done + +printf "Press ENTER to continue" +read -r