We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I've noticed that in FTPFS, the implementation of move comes from FS, however, when moving in FTPFS, it's too slow, especially when renaming.
The text was updated successfully, but these errors were encountered:
for example:
import fs from fs.ftpfs import FTPFS as _FTPFS from fs.ftpfs import ftp_errors class NotSupportedError(Exception): pass class FTPFS(_FTPFS): def move(self, src_path: str, dst_path: str, overwrite=False, preserve_time=False): try: with self._lock: _path = self.validatepath(dst_path) if not overwrite and self.exists(_path): raise fs.errors.DestinationExists(_path) with ftp_errors(self, _path): try: if overwrite: with ftp_errors(self, _path): if self.exists(_path): self.ftp.rename(_path, _path + ".pyfilesystem2.tmp") self.ftp.rename(src_path, dst_path) self.ftp.delete(_path + ".pyfilesystem2.tmp") else: self.ftp.rename(src_path, dst_path) except ftplib.error_perm as e: if str(e) == "550 RNTO failed.": # some ftp server does not support rename to other directory raise NotSupportedError() raise e except NotSupportedError: super().move(src_path, dst_path, overwrite, preserve_time)
Sorry, something went wrong.
No branches or pull requests
I've noticed that in FTPFS, the implementation of move comes from FS, however, when moving in FTPFS, it's too slow, especially when renaming.
The text was updated successfully, but these errors were encountered: