zoukankan      html  css  js  c++  java
  • 五、监听共享目录文件

    #!/usr/bin/python
    # -*- coding: utf-8 -*-
    
    import os;
    import glob;
    
    def login_share(ip, user, password):
        try:
            cmd = 'net use \\%s\ipc$ "%s" /user:"%s"'%(ip, password, user)
            #print('loging share: %s'%cmd);
            os.system("net use * /del /y");
            os.system(cmd);
            return True;
        except ValueError:
            return  False;
    
    login_share("172.17.2.198","wsy","123");
    
     
    
    def getDir(url):
        try:
            #list=os.listdir(url);
            list= glob.glob(url+'/*.xml')
            for temp in list:
                print(temp);
            return True;
        except ValueError:
            print("读取目录错误:"+ValueError);
            return False;
    
    getDir("//172.17.2.198/wsy1");
    
    input("");
  • 相关阅读:
    bzoj1648
    bzoj3404
    bzoj1650
    bzoj1625
    bzoj1606
    bzoj1464
    bzoj1572
    bzoj1617
    bzoj1092
    bzoj1091
  • 原文地址:https://www.cnblogs.com/shuyu/p/5105886.html
Copyright © 2011-2022 走看看