Closed ghost closed 3 years ago
AFAIK there isn't a builtin way to sort as you request the dir contents so you would have to do this after you've retrieved it all. Essentially
import smbclient entries = sorted( smbclient.scandir(r"\\server\share\dir"), key=lambda e: e.stat().st_mtime, reverse=True )
That will give you the directory listing that is sorted by st_mtime which is the number of seconds since EPOCH (1970-01-01). Have a look at sorting for more details.
st_mtime
AFAIK there isn't a builtin way to sort as you request the dir contents so you would have to do this after you've retrieved it all. Essentially
That will give you the directory listing that is sorted by
st_mtime
which is the number of seconds since EPOCH (1970-01-01). Have a look at sorting for more details.