python - 如何在python中将文件夹从服务器复制到客户端
问题描述
我正在尝试将文件夹从我的服务器复制到客户端,该文件位于 x 目录中。想知道如何在服务器中设置文件路径。
服务器端
filename = '/home/Desktop/features'
f = open(filename, 'rb')
while True:
l = f.read(buff_size)
while (l):
self.sock.sendall(l)
# print('Sent ',repr(l))
l = f.read(buff_size)
if not l:
f.close()
self.sock.close()
break
客户端
with open('red_fi', 'rb') as f:
print('file opened client ')
time.sleep(3)
a = True
while a:
print('receiving data...')
data = s.recv(buff_size)
# print('data=%s', (data))
if not data:
f.close()
# time.sleep(3)
print('file closed client')
a = False
break
# write data to a file
f.write(data)
# time.sleep(2)
print('Successfully received the file')
print(id_list)
s.close()
我希望将功能文件夹从服务器复制到客户端。
解决方案
推荐阅读
- gitlab - GitLab CI 在多个构建阶段之一完成后执行部署阶段
- r - 如何在 R 中的 ifelse 语句中使用 seq() 函数
- python - Pyinstaller 不读取 python 脚本的相对路径
- mongodb - MongoDB聚合日期直方图查询
- html - Safari 关注已保存密码的错误输入字段
- android - 处理中的“Android”按钮在哪里?
- node.js - 使用 WebdriverIO 运行 API 测试不会因错误的状态代码而失败。使用 Mocha 运行测试确实失败(如预期的那样)
- angular - 元素 mat-checkbox-ripple 被切断
- c# - 通过 REST 管理服务在 SMS_Collection 上执行 AddMembershipRule
- c++ - 将部分向量转换为字符串的最简单方法是什么?