1
0
mirror of https://github.com/limosek/zaf-plugins.git synced 2024-11-01 08:17:19 +01:00

Repaired fs discovery

This commit is contained in:
Lukas Macura 2016-04-04 14:48:57 +02:00
parent 15a5429ac0
commit 3dab455d27

View File

@ -17,9 +17,9 @@ Depends-bin: curl find
Item discovery: Item discovery:
Description:: Description::
Discovery of files or directories Discovery of files or directories. Enter % instead of * in mask.
:: ::
Parameters: directory mask type depth Parameters: directory mask depth type
Type: string Type: string
Script:: Script::
#!/bin/sh #!/bin/sh
@ -28,20 +28,12 @@ Script::
[ -z "$1" ] && zaf_err "Directory must be entered." [ -z "$1" ] && zaf_err "Directory must be entered."
dir="$1" dir="$1"
mask="-name '$(echo $2|tr '%' '*')'"
if [ -n "$2" ]; then depth="-maxdepth $3"
mask="-name '$2'"
fi
if [ -n "$3" ]; then
type="-type $3"
fi
if [ -n "$4" ]; then if [ -n "$4" ]; then
depth="-maxdepth $4" type="-type $4"
fi fi
zaf_dbg find "$dir" $type $depth $mask
eval find "$dir" $depth $type $mask | zaf_discovery '{#PATH}' eval find "$dir" $depth $type $mask | zaf_discovery '{#PATH}'
:: ::