summaryrefslogtreecommitdiff
path: root/home/xyz/.local/bin/orgext
diff options
context:
space:
mode:
authorxyz <gky44px1999@gmail.com>2021-10-19 01:58:25 -0700
committerxyz <gky44px1999@gmail.com>2021-10-19 01:58:25 -0700
commit4c85dda6a909779ffc880d853eea91c401f3f90f (patch)
treeab2e9ce8d5f7d34ac17c67d36551e30d2be95458 /home/xyz/.local/bin/orgext
parent2c5316899c99fd2315f8528f772f3e3a8fc71e8c (diff)
refactor
Diffstat (limited to 'home/xyz/.local/bin/orgext')
-rwxr-xr-xhome/xyz/.local/bin/orgext6
1 files changed, 2 insertions, 4 deletions
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 '_' -- '{}' \+
}