diff options
author | xyz <gky44px1999@gmail.com> | 2021-10-03 01:41:51 -0700 |
---|---|---|
committer | xyz <gky44px1999@gmail.com> | 2021-10-03 01:41:51 -0700 |
commit | 4cfa508c3077006e800a841074363882cb7f3965 (patch) | |
tree | 045a7da2cafc3cd3c31989a8d2d86389eacc2883 | |
parent | 0c73a3432b7c6984ad81f9e3bdee711a6832f667 (diff) |
change mind, use -execdir instead of -exec for find
-rwxr-xr-x | .local/bin/chmodef | 4 | ||||
-rwxr-xr-x | .local/bin/mvtr | 2 | ||||
-rwxr-xr-x | .local/bin/orgext | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/.local/bin/chmodef b/.local/bin/chmodef index 6836effd..be9b2934 100755 --- a/.local/bin/chmodef +++ b/.local/bin/chmodef @@ -1,5 +1,5 @@ #!/bin/sh # https://wiki.archlinux.org/title/File_permissions_and_attributes#Numeric_method -find "$@" -type d -exec chmod 755 -- '{}' \+ -find "$@" -type f -exec chmod 644 -- '{}' \+ +find "$@" -type d -execdir chmod 755 -- '{}' \+ +find "$@" -type f -execdir chmod 644 -- '{}' \+ diff --git a/.local/bin/mvtr b/.local/bin/mvtr index b48dcb20..d16f1a8d 100755 --- a/.local/bin/mvtr +++ b/.local/bin/mvtr @@ -4,4 +4,4 @@ # link also show perl-rename approach # https://linuxconfig.org/rename-all-files-from-uppercase-to-lowercase-characters # if only change ' ' to '_' `rename` might be sufficient, for upper to lower case might need perl-rename if want concise -find "$@" -depth -exec sh -c 'mv -nvT -- "$1" "$(echo "$1" | tr "[:upper:] " "[:lower:]_")"' shell '{}' \; +find "$@" -depth -execdir sh -c 'mv -nvT -- "$1" "$(echo "$1" | tr "[:upper:] " "[:lower:]_")"' shell '{}' \; diff --git a/.local/bin/orgext b/.local/bin/orgext index 58cc8b86..db813db2 100755 --- a/.local/bin/orgext +++ b/.local/bin/orgext @@ -7,14 +7,14 @@ outdir () { - find . -type f -exec mv -nt "$PWD" -- '{}' \+ + find . -type f -execdir mv -nt "$PWD" -- '{}' \+ find . -mindepth 1 -maxdepth 1 -type d -delete } indir () { find . -maxdepth 1 -type f | awk -F. '!a[$NF]++{print $NF}' | xargs mkdir -- - find . -mindepth 1 -maxdepth 1 -type d -exec basename -az -- '{}' \+ | xargs -0 -I _ find . -maxdepth 1 -type f -name '*._' -exec 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 |