$ pyftpsync download -v --progress . ftps://ftp.someserver.de
Download to /opt/workspace/working
from ftps://ftp.someserver.de/
Encoding local: utf-8, remote: utf-8
No credentials found in keyring('pyftpsync', 'ftp.someserver.de').
Using credentials from .netrc file: user_for_sync:***.
Login as 'user_for_sync'.
Could not send 'OPTS UTF-8': '502 Unknown OPS format.'
Sent 'OPTS UTF8 ON'.
Setting FTP encoding to utf-8 (was latin-1).
Server time offset: -15.34 seconds.
EQUAL = [01_Nara_SP]
SKIP UPLOAD > transfer.log.all
EQUAL = [test]
SKIP UPLOAD > transfer-ftp-old.tar.gz
SKIP UPLOAD > transfers_non_nagios.log
COPY UNMODIFIED < [..]
ERROR: [Errno 17] File exists: '/opt/workspace'
<EntryPair([..])>: (missing, unmodified) => copy_remote
Traceback (most recent call last):
File "/home/engl/.local/bin/pyftpsync", line 8, in <module>
sys.exit(run())
File "/home/engl/.local/lib/python3.8/site-packages/ftpsync/pyftpsync.py", line 242, in run
s.run()
File "/home/engl/.local/lib/python3.8/site-packages/ftpsync/synchronizers.py", line 1268, in run
res = super(DownloadSynchronizer, self).run()
File "/home/engl/.local/lib/python3.8/site-packages/ftpsync/synchronizers.py", line 827, in run
res = super(BiDirSynchronizer, self).run()
File "/home/engl/.local/lib/python3.8/site-packages/ftpsync/synchronizers.py", line 213, in run
res = self._sync_dir()
File "/home/engl/.local/lib/python3.8/site-packages/ftpsync/synchronizers.py", line 558, in _sync_dir
res = handler(pair)
File "/home/engl/.local/lib/python3.8/site-packages/ftpsync/synchronizers.py", line 851, in on_copy_remote
self._copy_recursive(self.remote, self.local, remote_entry)
File "/home/engl/.local/lib/python3.8/site-packages/ftpsync/synchronizers.py", line 333, in _copy_recursive
dest.mkdir(dir_entry.name)
File "/home/engl/.local/lib/python3.8/site-packages/ftpsync/targets.py", line 392, in mkdir
os.mkdir(path)
FileExistsError: [Errno 17] File exists: '/opt/workspace'
$ pyftpsync download -v --progress -x ".,.." . ftps://ftp.someserver.de
Download to /opt/workspace/working
from ftps://ftp.someserver.de/
Encoding local: utf-8, remote: utf-8
No credentials found in keyring('pyftpsync', 'ftp.someserver.de').
Using credentials from .netrc file: user_for_sync:***.
Login as 'user_for_sync'.
Could not send 'OPTS UTF-8': '502 Unknown OPS format.'
Sent 'OPTS UTF8 ON'.
Setting FTP encoding to utf-8 (was latin-1).
Server time offset: -15.37 seconds.
EQUAL = [01_Nara_SP]
SKIP UPLOAD > transfer.log.all
EQUAL = [test]
SKIP UPLOAD > transfer-ftp-old.tar.gz
SKIP UPLOAD > transfers_non_nagios.log
SKIP UNMATCHED - [..]
SKIP UNMATCHED - [.]
COPY UNMODIFIED < [02_Wakayama_SZ]
ERROR: [Errno 17] File exists: '/opt/workspace/working'
<EntryPair([02_Wakayama_SZ])>: (missing, unmodified) => copy_remote
Traceback (most recent call last):
File "/home/engl/.local/bin/pyftpsync", line 8, in <module>
sys.exit(run())
File "/home/engl/.local/lib/python3.8/site-packages/ftpsync/pyftpsync.py", line 242, in run
s.run()
File "/home/engl/.local/lib/python3.8/site-packages/ftpsync/synchronizers.py", line 1268, in run
res = super(DownloadSynchronizer, self).run()
File "/home/engl/.local/lib/python3.8/site-packages/ftpsync/synchronizers.py", line 827, in run
res = super(BiDirSynchronizer, self).run()
File "/home/engl/.local/lib/python3.8/site-packages/ftpsync/synchronizers.py", line 213, in run
res = self._sync_dir()
File "/home/engl/.local/lib/python3.8/site-packages/ftpsync/synchronizers.py", line 558, in _sync_dir
res = handler(pair)
File "/home/engl/.local/lib/python3.8/site-packages/ftpsync/synchronizers.py", line 851, in on_copy_remote
self._copy_recursive(self.remote, self.local, remote_entry)
File "/home/engl/.local/lib/python3.8/site-packages/ftpsync/synchronizers.py", line 340, in _copy_recursive
self._copy_recursive(src, dest, entry)
File "/home/engl/.local/lib/python3.8/site-packages/ftpsync/synchronizers.py", line 333, in _copy_recursive
dest.mkdir(dir_entry.name)
File "/home/engl/.local/lib/python3.8/site-packages/ftpsync/targets.py", line 392, in mkdir
os.mkdir(path)
FileExistsError: [Errno 17] File exists: '/opt/workspace/working'
$ pyftpsync download -v --progress -x ".,.." . ftps://ftp.someserver.de
Download to /opt/workspace/working
from ftps://ftp.someserver.de/
Encoding local: utf-8, remote: utf-8
No credentials found in keyring('pyftpsync', 'ftp.someserver.de').
Using credentials from .netrc file: user_for_sync:***.
Login as 'user_for_sync'.
Could not send 'OPTS UTF-8': '502 Unknown OPS format.'
Sent 'OPTS UTF8 ON'.
Setting FTP encoding to utf-8 (was latin-1).
Server time offset: -15.33 seconds.
EQUAL = [01_Nara_SP]
EQUAL = [02_Wakayama_SZ]
SKIP UPLOAD > transfer.log.all
EQUAL = [test]
SKIP UPLOAD > transfer-ftp-old.tar.gz
SKIP UPLOAD > transfers_non_nagios.log
SKIP UNMATCHED - [..]
SKIP UNMATCHED - [.]
SKIP UNMATCHED - [.]
SKIP UNMATCHED - [01_Nara_SP]
COPY UNMODIFIED < [01_Nara_SP/02_T-Stop_Tester]
ERROR: [Errno 17] File exists: '/opt/workspace/working/01_Nara_SP'
<EntryPair([01_Nara_SP/02_T-Stop_Tester])>: (missing, unmodified) => copy_remote
Changing to ftp root folder to remove lock file: /
Traceback (most recent call last):
File "/home/engl/.local/bin/pyftpsync", line 8, in <module>
sys.exit(run())
File "/home/engl/.local/lib/python3.8/site-packages/ftpsync/pyftpsync.py", line 242, in run
s.run()
File "/home/engl/.local/lib/python3.8/site-packages/ftpsync/synchronizers.py", line 1268, in run
res = super(DownloadSynchronizer, self).run()
File "/home/engl/.local/lib/python3.8/site-packages/ftpsync/synchronizers.py", line 827, in run
res = super(BiDirSynchronizer, self).run()
File "/home/engl/.local/lib/python3.8/site-packages/ftpsync/synchronizers.py", line 213, in run
res = self._sync_dir()
File "/home/engl/.local/lib/python3.8/site-packages/ftpsync/synchronizers.py", line 592, in _sync_dir
self._sync_dir()
File "/home/engl/.local/lib/python3.8/site-packages/ftpsync/synchronizers.py", line 558, in _sync_dir
res = handler(pair)
File "/home/engl/.local/lib/python3.8/site-packages/ftpsync/synchronizers.py", line 851, in on_copy_remote
self._copy_recursive(self.remote, self.local, remote_entry)
File "/home/engl/.local/lib/python3.8/site-packages/ftpsync/synchronizers.py", line 340, in _copy_recursive
self._copy_recursive(src, dest, entry)
File "/home/engl/.local/lib/python3.8/site-packages/ftpsync/synchronizers.py", line 333, in _copy_recursive
dest.mkdir(dir_entry.name)
File "/home/engl/.local/lib/python3.8/site-packages/ftpsync/targets.py", line 392, in mkdir
os.mkdir(path)
FileExistsError: [Errno 17] File exists: '/opt/workspace/working/01_Nara_SP'
So I was like, okay If getting an error if the folder already exists. I add a only mkdir if not exists.
This looks like this:
in ftpsync/targets.py on line 389 I Changed the def mkdir
:
def mkdir(self, dir_name):
self.check_write(dir_name)
path = normpath_url(join_url(self.cur_dir, dir_name))
if not self.dir_exists(path):
os.mkdir(path)
def dir_exists(self, path):
return os.path.isdir(path)
I Hope I could explain the Problem.