Regarding the listpath() method of SMBConnection class in pysmb and following on from this thread.
Using the SMBConnect listPath function pattern parameter, is it possible to specify more than one pattern?
Example:
This code only returns files from a Samba share that have a .pdf extension
files = newConn.listPath('C$', '/' + 'testing', pattern='*.pdf')
But I want to specify more than one pattern.. e.g: .pdf OR .doc
I tried using a regex like this but it doesn't work.
files = newConn.listPath('C$', '/' + 'testing', pattern="'^.*\.(pdf|doc)$'")
Any help much appreciated!
As per the accepted answer, it is not possible to filter on more than one file extension. There is a work around in another thread that gives the functionality I needed.
pysmb follows the SMB protocol closely. Unfortunately, the SMB protocol only supports wildcards but does not support regular expressions in the search pattern.