欧美三区_成人在线免费观看视频_欧美极品少妇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條評論
主站蜘蛛池模板: 最新中文字幕在线 | 4hu在线 | 欧美一级片免费看 | 精品久久影院 | 99免费视频| 成人app色深夜福利 欧美电影一区 | 久久一日本道色综合久久 | 夜夜操天天操 | 五月天色婷婷在线 | 成人午夜性视频欧美成人 | 亚洲国产精品综合久久网络 | 欧美一区二区三区在线播放 | 精品尤物 | 国产精品视频观看 | av国产精品 | 亚洲一区 中文字幕 | 日本亚洲精品色婷婷在线影院 | 国产高清在线视频 | 亚洲1区2区3区4区 | 91免费在线播放 | 免费的黄色一级片 | 插插插天天| 免费一区 | 国产精品入口麻豆 | 草草视频免费观看 | 国产福利在线免费 | 欧美激情久久欧美激情 | 成人久久一区 | 99久久精品国产一区二区三区 | 久久精品国产精品青草图片 | 免费的污污网站 | 亚洲欧美在线精品一区二区 | 久久久人成影片一区二区三区 | 黄色毛片视频网站 | 成人毛片在线播放 | 亚洲在线视频播放 | 久久综合综合久久 | 91视频一区 | 日韩网红少妇无码视频香港 | 国产精品中文字幕在线 | 91视频会员 |