diff options
author | Nils <git@velohero.com> | 2016-11-06 20:43:09 +0100 |
---|---|---|
committer | Nils <git@velohero.com> | 2016-11-06 20:43:09 +0100 |
commit | 3e4f3efd92f5cf58fd38272704c10e8d28b03d7c (patch) | |
tree | 893ee6beafa0604fa3026847f0f2de446e2b374f | |
parent | 73c51e54a2a74a2e0a062250bff64ce95ec5ebbb (diff) |
use find instead of ls
-rwxr-xr-x | gallery.sh | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -101,7 +101,7 @@ cat > "$htmlfile" << EOF EOF ### Photos (JPG) -if [[ $(ls -l | grep -i jpg | wc -l) -gt 0 ]]; then +if [[ $(find . -type f -name \*.jpg | wc -l) -gt 0 ]]; then echo '<div class="row">' >> "$htmlfile" ## Generate Images @@ -202,7 +202,7 @@ done fi ### Movies (MOV or MP4) -if [[ $(ls -l | grep -i "mov\|mp4" | wc -l) -gt 0 ]]; then +if [[ $(find . -type f -name \*.mov -o -name '*.mp4' | wc -l) -gt 0 ]]; then cat >> "$htmlfile" << EOF <div class="row"> <div class="col-xs-12"> @@ -212,7 +212,7 @@ if [[ $(ls -l | grep -i "mov\|mp4" | wc -l) -gt 0 ]]; then <div class="row"> <div class="col-xs-12"> EOF - if [[ $(ls -l | grep -i "mov" | wc -l) -gt 0 ]]; then + if [[ $(find . -type f -name \*.mov | wc -l) -gt 0 ]]; then for filename in *.[mM][oO][vV]; do filesize=$(ls -lah "$filename" | awk '{ print $5}') cat >> "$htmlfile" << EOF @@ -220,7 +220,7 @@ EOF EOF done fi - if [[ $(ls -l | grep -i "mp4" | wc -l) -gt 0 ]]; then + if [[ $(find . -type f -name \*.mp4 | wc -l) -gt 0 ]]; then for filename in *.[mM][pP]4; do filesize=$(ls -lah "$filename" | awk '{ print $5}') cat >> "$htmlfile" << EOF @@ -232,7 +232,7 @@ EOF fi ### Downloads (ZIP) -if [[ $(ls -l | grep -i zip | wc -l) -gt 0 ]]; then +if [[ $(find . -type f -name \*.zip | wc -l) -gt 0 ]]; then cat >> "$htmlfile" << EOF <div class="row"> <div class="col-xs-12"> |