0

added exceptions for .DS_Store and Thumbs.db in mirror_dir

This commit is contained in:
Aaron Griffith
2011-03-27 21:24:25 -04:00
parent c738777839
commit 4977ae8767

View File

@@ -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)):