From 41cda9a776fa7ca3622f072a0a70b6725fd8a812 Mon Sep 17 00:00:00 2001 From: xyz Date: Mon, 9 Aug 2021 13:25:00 -0700 Subject: remove orgext -e option, -e need recursive and not option for better usage, too much to fit in this script --- .local/bin/orgext | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to '.local/bin/orgext') diff --git a/.local/bin/orgext b/.local/bin/orgext index e4058f97..36960bd7 100755 --- a/.local/bin/orgext +++ b/.local/bin/orgext @@ -4,11 +4,6 @@ # references: # https://stackoverflow.com/questions/1842254/how-can-i-find-all-of-the-distinct-file-extensions-in-a-folder-hierarchy -getext () -{ - find . -maxdepth 1 -type f | awk -F. '!a[$NF]++{print $NF}' -} - outdir () { find . -type f -execdir mv -t "$PWD" '{}' \+ @@ -18,13 +13,12 @@ outdir () # may further optimize by output file extension names to a variable and use it for both mkdir and mv, current is fast enough for me indir () { - getext | xargs mkdir + find . -maxdepth 1 -type f | awk -F. '!a[$NF]++{print $NF}' | xargs mkdir # don't know why -print0/-0 for find and xargs doesn't work here find . -mindepth 1 -maxdepth 1 -type d -execdir basename '{}' \; | xargs -I _ find . -maxdepth 1 -type f -name '*._' -execdir mv -t '_' '{}' \+ } case "$1" in - '-e') getext;; '-o') outdir;; '-i') indir;; *) outdir; indir;; -- cgit v1.2.3-70-g09d2