dir-empty: Check if directories are empty

This commit is contained in:
neingeist 2023-02-27 21:27:03 +01:00
parent 258f472f06
commit 65a2002323

10
dir-empty Executable file
View file

@ -0,0 +1,10 @@
#!/bin/sh
# Check that all of the given directories are empty
for d in "$@"; do
if [[ -n "$(ls -1 "$d")" ]]; then
exit 1
fi
done
exit 0