Folder2Array for bash
This commit is contained in:
33
anduril/Folder2Array
Executable file
33
anduril/Folder2Array
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
|
||||
MAXDEPTH="-maxdepth 1"
|
||||
ME=$( basename "$0" )
|
||||
HELP='Create an array _index for Anduril of the given folder.
|
||||
|
||||
Usage: '$ME' [-r] [path]
|
||||
-r Recursively find all files in path, excluding folders
|
||||
|
||||
'
|
||||
|
||||
while getopts ":rh" opt; do
|
||||
case $opt in
|
||||
r)
|
||||
MAXDEPTH="-type f"
|
||||
;;
|
||||
h)
|
||||
echo "$HELP"
|
||||
exit 0
|
||||
;;
|
||||
\?)
|
||||
echo "Invalid option: -$OPTARG" >&2
|
||||
echo "$HELP" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND-1))
|
||||
INPATH="$1"
|
||||
[ -z "$INPATH" ] && INPATH=.
|
||||
|
||||
echo -e '"Key"'"\t"'"File"'
|
||||
find "$INPATH" -mindepth 1 $MAXDEPTH -not -name _index -printf '"%P"\t"%P"\n' | sort -V
|
||||
1
bin/Folder2Array
Symbolic link
1
bin/Folder2Array
Symbolic link
@@ -0,0 +1 @@
|
||||
../anduril/Folder2Array
|
||||
Reference in New Issue
Block a user