diff options
| author | Deposite Pirate | 2025-01-12 14:40:33 +0100 |
|---|---|---|
| committer | Deposite Pirate | 2025-01-12 14:40:33 +0100 |
| commit | e7764f9b08072cfb67c2d3ecf075df9a80aee6fd (patch) | |
| tree | 628d5f66e1d62f1d710bcbe472aa68b5e19522f8 /functions/renlow.fish | |
| parent | 62d7fa8cfa2e6de053d7c1238bd8fdcdf0cc8a7d (diff) | |
Import config.
Diffstat (limited to 'functions/renlow.fish')
| -rw-r--r-- | functions/renlow.fish | 21 |
1 files changed, 21 insertions, 0 deletions
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 |
