service_name = 'devcenter'
smb_dir = '/User/FFF/'
rootPath = r'D:/FF/FF/FF/'
for fpathe, dirs, fs in os.walk(rootPath):
for f in fs:
# print(os.path.join(fpathe, f))
fpp = open(os.path.join(fpathe, f), 'rb')
relativePath = fpathe.replace(rootPath, "")
try:
self.samba.createDirectory(service_name, os.path.join(smb_dir, relativePath))#先创建文件夹
except:
pass
self.samba.storeFile(service_name, os.path.join(smb_dir, relativePath,f), fpp)
fpp.close()
pysmb 上传一个文件夹
最新推荐文章于 2023-08-01 17:15:32 发布