diff options
author | xyz <gky44px1999@gmail.com> | 2021-08-24 23:27:16 -0700 |
---|---|---|
committer | xyz <gky44px1999@gmail.com> | 2021-08-24 23:27:16 -0700 |
commit | 320f877c1b3dd875dac0ae086dcc0ccce88fe307 (patch) | |
tree | d75b75b6f7e8b1582a835467841d70e1b130a0b2 /.local | |
parent | b61cb8eb98f1789a12ad26ecae858e9eb5d1f891 (diff) |
consider -- situation for orgext
Diffstat (limited to '.local')
-rwxr-xr-x | .local/bin/orgext | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/.local/bin/orgext b/.local/bin/orgext index ed53c271..e652df61 100755 --- a/.local/bin/orgext +++ b/.local/bin/orgext @@ -7,16 +7,16 @@ outdir () { - find . -type f -execdir mv -t "$PWD" '{}' \+ - find . -mindepth 1 -maxdepth 1 -type d -execdir rm -r '{}' \+ + find . -type f -execdir mv -t "$PWD" -- '{}' \+ + find . -mindepth 1 -maxdepth 1 -type d -execdir rm -r -- '{}' \+ } # 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 # maybe better if make all uppercase to lowercase, is it possible to use awk for that? 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 '_' '{}' \+ + 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 '_' -- '{}' \+ } case "$1" in |