@Burunduk
That last script of yours does not work for me. I'll go with the following which gives the desired results. Topic marked as solved:
Code: Select all
D=/tmp/.packages
tmpfile=`mktemp`
for file in "$D"/*; do
while read -r line; do
[ -f "$line" ] && printf "%s\n" "$line"
done <"$file" >"$tmpfile"
mv "$tmpfile" "$file"
done
find "$D" -mindepth 1 -empty -delete