首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >通过RDP连接传输文件

问通过RDP连接传输文件
EN

Stack Overflow用户
提问于 2019-06-22 02:25:29
回答 1查看 275关注 0票数 0

正在尝试将文件从远程桌面复制到本地。这是一段尝试...

代码语言:javascript
复制
import os
import os.path
import shutil
import sys
import win32wnet

def netcopy(host, source, dest_dir, username=None, password=None, move=False):
    """ Copies files or directories to a remote computer. """

    wnet_connect(host, username, password)

    dest_dir = covert_unc(host, dest_dir)

    # Pad a backslash to the destination directory if not provided.
    if not dest_dir[len(dest_dir) - 1] == '\\':
        dest_dir = ''.join([dest_dir, '\\'])

    # Create the destination dir if its not there.
    if not os.path.exists(dest_dir):
        os.makedirs(dest_dir)
    else:
        # Create a directory anyway if file exists so as to raise an error.
         if not os.path.isdir(dest_dir):
             os.makedirs(dest_dir)

    if move:
        shutil.move(source, dest_dir)
    else:
        shutil.copy(source, dest_dir)

试图弄清楚如何建立连接并将文件复制到我的本地。这里是python的新手。

EN

回答 1

Stack Overflow用户

发布于 2019-06-22 02:32:47

您是否在使用RDP客户端?这是windows linux还是mac?您使用的是哪个应用程序?这是你写的代码吗?你知道什么是虚拟频道吗?NLA开启了吗?THere是您提供的很少的信息。你能连接上吗?你能ping通服务器吗?

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56708677

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档