From 4c85dda6a909779ffc880d853eea91c401f3f90f Mon Sep 17 00:00:00 2001 From: xyz Date: Tue, 19 Oct 2021 01:58:25 -0700 Subject: refactor --- home/xyz/.local/bin/orgext | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'home/xyz/.local/bin/orgext') diff --git a/home/xyz/.local/bin/orgext b/home/xyz/.local/bin/orgext index f1654d2c..de5dc695 100755 --- a/home/xyz/.local/bin/orgext +++ b/home/xyz/.local/bin/orgext @@ -5,14 +5,12 @@ # not sure if find here need -depth, not sure if mv here need -n and -T -outdir () -{ +outdir () { find . -type f -execdir mv -nt "$PWD" -- '{}' \+ find . -mindepth 1 -maxdepth 1 -type d -delete } -indir () -{ +indir () { find . -maxdepth 1 -type f | awk -F. '!a[$NF]++{print $NF}' | xargs mkdir -- find . -mindepth 1 -maxdepth 1 -type d -execdir basename -az -- '{}' \+ | xargs -0 -I _ find . -maxdepth 1 -type f -name '*._' -execdir mv -t '_' -- '{}' \+ } -- cgit v1.2.3-70-g09d2