Skip to content

Commit

Permalink
download files in order
Browse files Browse the repository at this point in the history
  • Loading branch information
Changaco committed Feb 17, 2018
1 parent 4bb6d94 commit 7b55483
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions legi/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@ def download_legi(dst_dir):
ftph.connect(DILA_FTP_HOST, DILA_FTP_PORT)
ftph.login()
ftph.cwd(DILA_LEGI_DIR)
remote_files = {filename: {} for filename in ftph.nlst() if 'legi_' in filename}
local_set = set(local_files.keys())
remote_set = set(remote_files.keys())
common_files = list(local_set & remote_set)
missing_files = list(remote_set - local_set)
remote_files = [filename for filename in ftph.nlst() if 'legi_' in filename]
common_files = [f for f in remote_files if f in local_files]
missing_files = [f for f in remote_files if f not in local_files]
remote_files = {filename: {} for filename in remote_files}
for filename in common_files:
local_files[filename]['size'] = os.path.getsize(
os.path.join(dst_dir, filename)
Expand Down

0 comments on commit 7b55483

Please sign in to comment.