looqs/delindex

22 строки
369 B
Plaintext
Исходник Обычный вид История

2018-01-03 09:40:13 +01:00
#!/bin/sh
TEMPFILE=$(mktemp)
2018-01-05 13:52:40 +01:00
DBFILE="$EASYINDEX_PATH"
2018-01-03 09:40:13 +01:00
function todelete()
{
echo "DELETE FROM file WHERE path = '$1';" >> /"$TEMPFILE"
}
echo "BEGIN TRANSACTION;" >> /"$TEMPFILE"
sqlite3 "$DBFILE" "SELECT path FROM file;"| while read line ; do
[ -e "$line" ] || todelete "$line"
done
echo "COMMIT TRANSACTION;" >> /"$TEMPFILE"
sqlite3 "$DBFILE" < /"$TEMPFILE"