Skip to content

Instantly share code, notes, and snippets.

@xgrg
Last active December 29, 2015 02:38
Show Gist options
  • Save xgrg/7601452 to your computer and use it in GitHub Desktop.
Save xgrg/7601452 to your computer and use it in GitHub Desktop.
Compare files list on catishared and files for catidb
import os, string, catidb
rql = 'Distinct Any P WHERE FP is FileParameter, FP file F , F path P'
db = catidb.CatiDB('user', 'Passe, le mot.')
res = [e[0] for e in db.rql(rql)]
dbdir = '/neurospin/cati/cati_shared/MEMENTO'
totalfiles = []
for root, dirs, files in os.walk(dbdir):
if root.startswith(os.path.join(dbdir, 'ACTIONS')) or root.startswith(os.path.join(dbdir, 'study_data')): continue
totalfiles.extend([os.path.join(root, e) for e in files if os.path.splitext(e)[1] not in ['.md5']])
totalfiles = [string.replace(e, dbdir, 'MEMENTO') for e in totalfiles]
diff = set(totalfiles).difference(set(res)) # ou l'inverse
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment