def extract_timestamp(file_path):
return os.path.getmtime(file_path)
-def find_file(dir_path, file_name, file_size):
+def find_file(dir_path, file_name, file_size, exclude_dir):
for root, dirs, files in os.walk(dir_path):
+ if root == exclude_dir:
+ continue
for f in files:
if f == file_name:
full_path = os.path.join(root, f)
if not os.path.exists(dst_file_path):
alt_dst_dir = misc.find_file(args.DEST_DIR,
src_file_name,
- os.path.getsize(src_file_path))
+ os.path.getsize(src_file_path),
+ exclude_dir=args.SOURCE_DIR)
if alt_dst_dir:
dst_dir = alt_dst_dir
dst_file_path = os.path.join(dst_dir, src_file_name)