delete_empty.sh: Don't clean out root filesystem if shared folder does not exist

As OpenWrt still needs a more verbose script then a simple find command,
we need to stick at this. The script now exits if the target directory does
not exist.

Also we try to reduce the amount of files checked in the while clause with
reducing the find output to regular files only.

Closed: #133
This commit is contained in:
Matthias Strubel 2016-01-24 12:14:21 +01:00
parent 28f1cd0153
commit 27b8474e52

View file

@ -1,12 +1,17 @@
#!/bin/sh
# This script is needed for Piratebox on OpenWrt.
# The find utility there has only a limited feature set.
IFS='
'
# Change directory, if not exist exit to not cleanup the
# OS filesystem.
cd $1 || exit 1
cd $1
ls_list=$( find ./ )
ls_list=$( find ./ -type f )
for filename in $ls_list
do