1
0

Add home/.config/ranger/scripts/dotify.sh

This commit is contained in:
Jeff Lance 2024-03-08 18:19:40 +01:00
parent 5b493d5888
commit 3de17747c6

View File

@ -0,0 +1,27 @@
#!/bin/env bash
# File : conf.d/ranger/scripts/dotify.sh
# Author : Jeff Lance <email@jefflance.me>
# Date : 01.10.2023 19:06:09
# Last Modified Date: 01.10.2023 19:06:09
# Last Modified By : Jeff Lance <email@jefflance.me>
#
# 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