summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxyz <gky44px1999@gmail.com>2021-08-13 05:41:41 -0700
committerxyz <gky44px1999@gmail.com>2021-08-13 05:41:41 -0700
commitbbb00154c123604467287e0c6038550cdccbfad7 (patch)
tree2f9c6cb686b95e9dc7574a9712fc7ae14759ff0b
parent3d75fadace421bf3768ae901a5825f86b04ce614 (diff)
orgext use basename -za, output end with \0 and multiple input to suit find \+
-rwxr-xr-x.local/bin/orgext3
1 files changed, 1 insertions, 2 deletions
diff --git a/.local/bin/orgext b/.local/bin/orgext
index 36960bd7..103d8a77 100755
--- a/.local/bin/orgext
+++ b/.local/bin/orgext
@@ -14,8 +14,7 @@ outdir ()
indir ()
{
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 '_' '{}' \+
+ find . -mindepth 1 -maxdepth 1 -type d -execdir basename -az '{}' \+ | xargs -0 -I _ find . -maxdepth 1 -type f -name '*._' -execdir mv -t '_' '{}' \+
}
case "$1" in