From 4977ae876756eb0c0f0104b1e28d4e43a883b1e5 Mon Sep 17 00:00:00 2001 From: Aaron Griffith Date: Sun, 27 Mar 2011 21:24:25 -0400 Subject: [PATCH] added exceptions for .DS_Store and Thumbs.db in mirror_dir --- googlemap.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/googlemap.py b/googlemap.py index 3541e28..840d2ac 100644 --- a/googlemap.py +++ b/googlemap.py @@ -35,9 +35,17 @@ def mirror_dir(src, dst, entities=None): if not os.path.exists(dst): os.mkdir(dst) if entities and type(entities) != list: raise Exception("Expected a list, got a %r instead" % type(entities)) - + + # files which are problematic and should not be copied + # usually, generated by the OS + skip_files = ['Thumbs.db', '.DS_Store'] + for entry in os.listdir(src): - if entities and entry not in entities: continue + if entry in skip_files: + continue + if entities and entry not in entities: + continue + if os.path.isdir(os.path.join(src,entry)): mirror_dir(os.path.join(src, entry), os.path.join(dst, entry)) elif os.path.isfile(os.path.join(src,entry)):