added numbering for keys
This commit is contained in:
@@ -3,20 +3,25 @@ set -f
|
|||||||
|
|
||||||
MAXDEPTH="-maxdepth 1"
|
MAXDEPTH="-maxdepth 1"
|
||||||
HIDDEN="-not -path */\.*"
|
HIDDEN="-not -path */\.*"
|
||||||
|
KEYS="awk {gsub(/\//,\"_\",\$1);print}"
|
||||||
ME=$( basename "$0" )
|
ME=$( basename "$0" )
|
||||||
HELP='Create an array _index for Anduril of the given folder.
|
HELP='Create an array _index for Anduril of the given folder.
|
||||||
|
|
||||||
Usage: '$ME' [-ar] [path]
|
Usage: '$ME' [-anr] [path]
|
||||||
-a Include ".*" hidden files
|
-a Include ".*" hidden files
|
||||||
|
-n Use number for key
|
||||||
-r Recursively find all files in path, exclude folder names from output
|
-r Recursively find all files in path, exclude folder names from output
|
||||||
|
|
||||||
'
|
'
|
||||||
|
|
||||||
while getopts ":arh" opt; do
|
while getopts ":anrh" opt; do
|
||||||
case $opt in
|
case $opt in
|
||||||
a)
|
a)
|
||||||
HIDDEN=""
|
HIDDEN=""
|
||||||
;;
|
;;
|
||||||
|
n)
|
||||||
|
KEYS='awk $1=NR'
|
||||||
|
;;
|
||||||
r)
|
r)
|
||||||
MAXDEPTH="-type f"
|
MAXDEPTH="-type f"
|
||||||
;;
|
;;
|
||||||
@@ -36,4 +41,5 @@ INPATH="$1"
|
|||||||
[ -z "$INPATH" ] && INPATH=.
|
[ -z "$INPATH" ] && INPATH=.
|
||||||
|
|
||||||
echo -e '"Key"'"\t"'"File"'
|
echo -e '"Key"'"\t"'"File"'
|
||||||
find "$INPATH" -mindepth 1 $MAXDEPTH $HIDDEN -not -name _index -printf '"%P"\t"%P"\n' | sort -V
|
find "$INPATH" -mindepth 1 $MAXDEPTH $HIDDEN -not -name _index -printf '"%P"\t"%P"\n' \
|
||||||
|
| sort -V | $KEYS
|
||||||
|
|||||||
Reference in New Issue
Block a user