Is there a way to determine if an object is a file or directory using the st_mode value? I am using paramiko lstat () to extract st_mode information from sftp files.
Yes, the stat structure st_mode contains this information.
st_mode
Use the stat module to determine if this is a directory:
stat
import stat if stat.S_ISDIR(lstat_result.st_mode):
Source: https://habr.com/ru/post/951617/More articles:iOS connects / connects to Bluetooth device using external accessories and MFI - iosTypeScript error - visual-studio-2012Get public Twitter tweets API 1.1 - androidHow to check the remote path - is it a file or directory? - pythonDoctrine2 / Symfony2 - Multiple objects on the same table - multiple-inheritanceAndroid Threading: this handler class must be static or a leak may occur - javaCheck if tabBar is displayed in iOS app. - iosSymfony 2 / Doctrine 2: two objects for one table, use one in favor of the other - phpTortoise SVN wines show no-sense - svnThis handler class must be static or a leak may occur (com.test.test3.ui.MainActivity.1) - androidAll Articles