From 3c976b398fe20b2e6953182f427d87177358a1b4 Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Tue, 30 Apr 2019 23:52:49 +0200 Subject: [PATCH] We collect files to move. Some cases another transfer can start and finish before this instance gets to the file. To not transfere duplicates we now check if the file exists with getFiles before we start a transfere. If its at the remote path we simply continue to the next file. --- transatlanticTorrentExpress.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/transatlanticTorrentExpress.py b/transatlanticTorrentExpress.py index 6bac4f8..de5a04f 100755 --- a/transatlanticTorrentExpress.py +++ b/transatlanticTorrentExpress.py @@ -33,6 +33,10 @@ def transferFiles(files, localPath, remotePath, host=None, user=None): for file in files: logger.info('Moving file: {}'.format(file)) + if file in getFiles(remotePath, host, user): + logger.info('File already exists at remote path. Skipping.') + continue + file = os.path.join(localPath, file) if (host and user):