[英]how to read network computer files by wmi in python
I am using wmi module in python for network connection. 我在python中使用wmi模块进行网络连接。 I need to read all files which are present in network computer drives.
我需要读取网络计算机驱动器中存在的所有文件。 So give me suggestion how can i do by using wmi module.
所以给我建议,我该如何使用wmi模块。
I have done connection by below code and now i need to read files inside network computer drive. 我已经通过下面的代码完成了连接,现在我需要读取网络计算机驱动器中的文件。
import wmi
ip = '192.168.1.18'
username = 'xxxxxx'
password = 'xxxxxx'
connection = wmi.WMI(ip, user=username, password=password)
for disk in connection.Win32_LogicalDisk (DriveType=3):
print disk.Caption
WMI does not have anything to read/write file content. WMI没有任何内容可读取/写入文件。 You can only read the meta data associated with a file using CIM_DataFile but not the content of the file.
您只能使用CIM_DataFile读取与文件关联的元数据,而不能读取文件的内容。 So, all you need to do is enumerate the files using CIM_DataFile and use one of the shell commands to read the content.
因此,您所需要做的就是使用CIM_DataFile枚举文件,并使用其中一个shell命令读取内容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.