Previous topic

SharedDevice Class

Next topic

SMB Exceptions

This Page

SharedFile Class

class smb.base.SharedFile(create_time, last_access_time, last_write_time, last_attr_change_time, file_size, alloc_size, file_attributes, short_name, filename)[source]

Contain information about a file/folder entry that is shared on the shared device.

As an application developer, you should not need to instantiate a SharedFile instance directly in your application. These SharedFile instances are usually returned via a call to listPath method in smb.SMBProtocol.SMBProtocolFactory.

If you encounter SharedFile instance where its short_name attribute is empty but the filename attribute contains a short name which does not correspond to any files/folders on your remote shared device, it could be that the original filename on the file/folder entry on the shared device contains one of these prohibited characters: “/[]:+|<>=;?,* (see [MS-CIFS]: 2.2.1.1.1 for more details).

alloc_size = None

Total number of bytes allocated to store this file

create_time = None

Float value in number of seconds since 1970-01-01 00:00:00 to the time of creation of this file resource on the remote server

file_attributes = None

A SMB_EXT_FILE_ATTR integer value. See [MS-CIFS]: 2.2.1.2.3

file_size = None

File size in number of bytes

filename = None

Unicode string containing the long filename of this file. Each OS has a limit to the length of this file name. On Windows, it is 256 characters.

isDirectory[source]

A convenient property to return True if this file resource is a directory on the remote server

isReadOnly[source]

A convenient property to return True if this file resource is read-only on the remote server

last_access_time = None

Float value in number of seconds since 1970-01-01 00:00:00 to the time of last access of this file resource on the remote server

last_attr_change_time = None

Float value in number of seconds since 1970-01-01 00:00:00 to the time of last attribute change of this file resource on the remote server

last_write_time = None

Float value in number of seconds since 1970-01-01 00:00:00 to the time of last modification of this file resource on the remote server

short_name = None

Unicode string containing the short name of this file (usually in 8.3 notation)