Skip to content

Commit

Permalink
Add checks for path names and ignore hidden files
Browse files Browse the repository at this point in the history
  • Loading branch information
samj1912 committed Dec 29, 2016
1 parent 31d3fcf commit 83dfe51
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion picard/file.py
Expand Up @@ -355,7 +355,13 @@ def _move_additional_files(self, old_filename, new_filename):
patterns = filter(bool, [p.strip() for p in patterns.split()])
for pattern in patterns:
pattern_regex = re.compile(fnmatch.translate(pattern), re.IGNORECASE)
for old_file in os.listdir(old_path):
try:
names = os.listdir(old_path)
except os.error:
return
if pattern[0] != '.':
names = filter(lambda x: x[0] != '.', names)
for old_file in names:
if pattern_regex.match(old_file):
old_file = os.path.join(old_path, old_file)
# FIXME we shouldn't do this from a thread!
Expand Down

0 comments on commit 83dfe51

Please sign in to comment.