22 linhas
369 B
Bash
Ficheiro executável
22 linhas
369 B
Bash
Ficheiro executável
#!/bin/sh
|
|
TEMPFILE=$(mktemp)
|
|
DBFILE="$EASYINDEX_PATH"
|
|
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"
|
|
|
|
|
|
|
|
|