~ubuntu-branches/ubuntu/saucy/darktable/saucy

« back to all changes in this revision

Viewing changes to tools/purge_non_existing_images.sh

  • Committer: Bazaar Package Importer
  • Author(s): David Bremner
  • Date: 2011-07-12 09:36:46 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20110712093646-yp9dbxan44dmw15h
Tags: 0.9-1
* New upstream release.
* Remove all patches now upstream; only patch for
  -Wno-error=unused-but-set-variable remains.
* Bump Standards-Version to 3.9.2 (no changes)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
 
 
3
DBFILE=~/.config/darktable/library.db
 
4
QUERY="select A.id,B.folder,A.filename from images as A join film_rolls as B on A.film_id = B.id"
 
5
sqlite3 $DBFILE "$QUERY"| while read result
 
6
do
 
7
  ID=$(echo $result | cut -f1 -d"|")
 
8
  FD=$(echo $result | cut -f2 -d"|")
 
9
  FL=$(echo $result | cut -f3 -d"|")
 
10
  if ! [ -f $FD/$FL ];
 
11
  then
 
12
    echo "removing non existent file $FD/$FL"
 
13
    # uncomment this dangerous line to actually do it:
 
14
    # sqlite3 $DBFILE "delete from images where id=$ID"
 
15
  fi
 
16
done