如何使用 Python 将文件从 Ubuntu 传输到 Windows

How to transfer file from Ubuntu to Windows using Python

我正在尝试使用 python 自动将文件从 Ubuntu(Linux) 传输到 Window 系统。我坚持如何实现这一点。谁能给我建议一种实现方法。 我为此输入的是用户名、密码和脚本的 windows 路径。

你没有解释传输文件是什么意思,如果你想在同一台计算机上传输(有Windows文件系统和Linux 一个在两个不同的磁盘分区上)或在两个不同的磁盘分区上。你应该从网络的角度考虑 communication protocols and file systems.

对于远程文件传输,考虑网络 communication protocols : you might consider using rcp or scp or HTTPS or HTTP or rsync or to transfer the files (see this and that). Take into account cybersecurity considerations, so consider Python cryptographic services. You could also consider network file systems such as NFS or CIFS (a.k.a. SMB) or sshfs. HTTP and HTTPS and SSH protocols (both client and server side, look also into libssh) which is widely supported by Python or Guile 绑定。

对于不同磁盘分区之间的本地计算机传输,请考虑 file systems, you could consider mounting the other's OS partition. Be then aware of VFAT or NTFS and CIFS support in Linux, and Ext2fs 和 Windows 上的 NFS 支持。

您可以在 Python (with pycurl and/or other Internet protocols) or Guile quite easily web services. Be aware of SOAP and REST (and SMTP to send emails). You could be interested by WebSockets 中编写代码来编写漂亮的 Web 界面。您可能对 Python 或 Guile 绑定到 SMTP 客户端库、HTTPS 或 libssh 服务器或客户端库感兴趣。

也考虑使用 distributed version control systems such as git - with a remote repository. Of course you'll find pygit2,一个 Python 绑定到它,当然 git 是 运行 服务器端和客户端 Windows 和 Linux.

还要注意提到的法律许可注意事项 here