欧美三区_成人在线免费观看视频_欧美极品少妇xxxxⅹ免费视频_a级毛片免费播放_鲁一鲁中文字幕久久_亚洲一级特黄

利用python計算windows全盤文件md5值的腳本

系統 1870 0
            
import hashlib
import os
import time
import configparser
import uuid
 
def test_file_md5(file_path):
  test = hashlib.md5()
 
  if os.path.isfile(file_path):
    with open(file_path, "rb") as f:
      while True:
        data = f.read(8096)
        if not data:
          break
        else:
          test.update(data)
      ret = test.hexdigest()
      config = configparser.ConfigParser()
 
      config.read("E:/python/pycharm/再開次開始/前端/test_md5.ini",encoding="utf-8")
      if config.has_section(os.path.basename(file_path)):
        new_section_name = str(os.path.basename(file_path)) + ":" + str(uuid.uuid4())
        config[new_section_name] = {"文件路徑":os.path.dirname(file_path),
                 "md5值":ret}
      else:
        config[os.path.basename(file_path)] = {"文件路徑": os.path.dirname(file_path),
                        "md5值": ret}
      config.write(open("E:/python/pycharm/再開次開始/前端/test_md5.ini","w",encoding="utf-8"))
 
 
 
def test_dir_md5(file_path):
  test_abs_path = os.path.abspath(file_path)
  # print(test_abs_path)
  os.chdir(test_abs_path)
  for file in os.listdir(os.getcwd()):
    if os.path.isfile(file):
      test_file_md5(os.path.abspath(file))
    elif os.path.isdir(file):
      test_dir_md5(os.path.abspath(file))
    else:
      pass
  # return True
 
 
if __name__ == '__main__':
  began_path = os.getcwd()
  test_path = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(began_path))))
  os.chdir(test_path)
  print(os.listdir())
  for test_file in os.listdir():
    os.chdir(test_path)
    if os.path.abspath(test_file).startswith("E:\\$"):
      continue
    else:
      if os.path.isfile(test_file):
        # print("yyyyy")
        test_file_md5(os.path.abspath(test_file))
      elif os.path.isdir(test_file):
        # print("hahah")
        test_dir_md5(os.path.abspath(test_file))
        # print(os.path.abspath(test_file))
      else:
        pass
          

結果如下

利用python計算windows全盤文件md5值的腳本_第1張圖片

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 日韩中文字幕在线观看视频 | 成人国产在线观看 | 99久久99| 99精品视频在线视频免费观看 | av在线电影网址 | 亚洲欧美久久婷婷爱综合一区天堂 | 九色在线视频 | 夜夜爽天天狠狠九月婷婷 | 亚洲狠狠干 | 91青青国产在线观看免费 | www.色综合 | 福利网在线 | 成人欧美一区在线视频在线观看 | 欧美6一10sex性hd | 欧美激情一区二区三级高清视频 | 欧美18xxxx| 欧美一区二三区 | 国产精品久久久久久久久久红粉 | 国产精品免费观看 | 久久久久国产一区二区三区四区 | 欧美日韩北条麻妃一区二区 | 国产精品国产精品 | 色秀视频免费高清网站 | 国产色产综合色产在线观看视频 | 亚瑟天堂久久一区二区影院 | 色人阁网站 | 日韩app| 天天干精品 | 久久夜夜 | 91久久国产露脸精品免费 | 日韩日韩日韩日韩 | 国产毛片视频 | 91在线 | 欧美 | 91精品国产综合久久欧美 | 五月婷六月婷婷 | 日本妇人成熟A片一区-老狼 | 国产精品久久久久久久久软件 | 丁香婷婷久久久综合精品国产 | 日韩精品亚洲一级在线观看 | 亚洲已满18点击进入在线观看 | 亚洲av毛片久久久久 |