is there any way to identify whether an object is file or directory using st_mode value? I'm using paramiko lstat() to retrieve the st_mode information from sftp files.
Yes, the stat structure st_mode
does contain that information.
Use the stat
module to determine if it is a directory:
import stat
if stat.S_ISDIR(lstat_result.st_mode):