From e7764f9b08072cfb67c2d3ecf075df9a80aee6fd Mon Sep 17 00:00:00 2001 From: Deposite Pirate Date: Sun, 12 Jan 2025 14:40:33 +0100 Subject: Import config. --- functions/renlow.fish | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 functions/renlow.fish (limited to 'functions/renlow.fish') diff --git a/functions/renlow.fish b/functions/renlow.fish new file mode 100644 index 0000000..98b0e4c --- /dev/null +++ b/functions/renlow.fish @@ -0,0 +1,21 @@ +function renlow --description 'Rename all files and directories with lowercase characters' + +if not command -sq 'find' + echo "Can't find find." + return 1 +end + +for file in (find . -type f) + set -l element (string split -r -m1 / $file) + mv $file $element[1]/(string lower $element[2]) +end + +set -f dirs (find . -type d) +for dir in $dirs[-1..1] # Rename directories in reverse order + set -l element (string split -r -m1 / $dir) + if not test -z $element[2] # Catch . + mv $dir $element[1]/(string lower $element[2]) + end +end + +end -- cgit v1.3.1