Python - pysmb move directory or access subfolders to move files

Asked

Viewed 32 times

1

I’m programming in python to access the linux environment, using the samba protocol, pysbm, I made the connections with the server and in it there is a directory in which folders enter and leave at all times, so using pysmb, when there is folder in this directory, I’m trying to move them to the folder where my main.py is.

from smb.SMBConnection import SMBConnection

def list_folder(connection, shared_device, path, pattern_file):
        listDir = connection.listPath(shared_device, path, search=65591, pattern= pattern_file, timeout=60)
        for f in listDir:
            if f.isDirectory:
                with open(f.filename, 'wb') as file_obj:
                 connection.retrieveFile(shared_device, path + f.filename, file_obj, timeout=60)

but that way it is not possible to move the folder with the functions it has in Sbmconnectiton, there is some way to move the folder in a linux environment?

I found this question similar, but it has no answer:

https://stackoverflow.com/questions/51832638/copy-all-files-in-directory-subdirectories-from-samba-with-python

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.