mirror of
https://github.com/jarun/nnn.git
synced 2024-11-18 08:59:14 +00:00
Merge pull request #1186 from KlzXS/recursive_batch_rename
Added recursive capabilities to .nmv
This commit is contained in:
commit
2435263052
17
plugins/.nmv
17
plugins/.nmv
|
@ -20,6 +20,7 @@ EDITOR="${EDITOR:-vi}"
|
||||||
TMPDIR="${TMPDIR:-/tmp}"
|
TMPDIR="${TMPDIR:-/tmp}"
|
||||||
INCLUDE_HIDDEN="${INCLUDE_HIDDEN:-0}"
|
INCLUDE_HIDDEN="${INCLUDE_HIDDEN:-0}"
|
||||||
VERBOSE="${VERBOSE:-0}"
|
VERBOSE="${VERBOSE:-0}"
|
||||||
|
RECURSIVE="${RECURSIVE:-0}"
|
||||||
|
|
||||||
selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection}
|
selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection}
|
||||||
exit_status=0
|
exit_status=0
|
||||||
|
@ -38,11 +39,19 @@ fi
|
||||||
if [ "$resp" = "s" ]; then
|
if [ "$resp" = "s" ]; then
|
||||||
arr=$(tr '\0' '\n' < "$selection")
|
arr=$(tr '\0' '\n' < "$selection")
|
||||||
else
|
else
|
||||||
if [ "$INCLUDE_HIDDEN" -eq 0 ]; then
|
findcmd="find . ! -name ."
|
||||||
arr=$(find . ! -name . -prune ! -name ".*" -print | sort)
|
|
||||||
else
|
if [ "$RECURSIVE" -eq 0 ]; then
|
||||||
arr=$(find . ! -name . -prune -print | sort)
|
findcmd="$findcmd -prune"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$INCLUDE_HIDDEN" -eq 0 ]; then
|
||||||
|
findcmd="$findcmd ! -name \".*\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
findcmd="$findcmd -print"
|
||||||
|
|
||||||
|
arr=$(eval "$findcmd" | sort)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
lines=$(printf "%s\n" "$arr" | wc -l)
|
lines=$(printf "%s\n" "$arr" | wc -l)
|
||||||
|
|
Loading…
Reference in a new issue