add Filter for Files

* exclude Files in  Trash & Clone Folder
* exclude Files < 1Kb directly
-> Clean DB from them
This commit is contained in:
6543 2019-05-11 21:57:10 +02:00
parent ebc7484c82
commit 58c5f080b2

View File

@ -65,13 +65,14 @@ function main() {
#clean DB from old stuff
{
db_query "DELETE From File WHERE (Size=0 OR Size IS NULL OR MD5='' OR MD5 IS NULL OR Name='') AND (TTSync=$TTSYNC_EXIST OR TTSync=$TTSYNC_BACKUP);"
db_query "DELETE FROM File WHERE Folder LIKE 'Clone/%' OR Folder LIKE '.Trash-%';"
#find dublicates !
}

#erselle zwei dateilisten
list_tmp=$(mktemp -d)
db_query "SELECT CONCAT('$moviedir/', Folder, '/', Name) FROM File WHERE TTSync=$TTSYNC_EXIST OR TTSync=$TTSYNC_BACKUP;" > "$list_tmp/indb"
find "$moviedir" -type f > "$list_tmp/exist"
find "$moviedir" -type f -size +1k | grep -v '/Clone/' | grep -v '/.Trash-' > "$list_tmp/exist"

#find new files
grep -vf "$list_tmp/indb" "$list_tmp/exist" > "$list_tmp/new"