欧美三区_成人在线免费观看视频_欧美极品少妇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條評論
主站蜘蛛池模板: av在线国产精品 | 亚洲欧洲另类 | 免费中文字幕日韩欧美 | 亚洲精品久久久久中文字幕二区 | 久久久久久免费播放一级毛片 | 日本xxxx18高清免费 | 久久综合九色综合桃花 | 五月婷婷导航 | 日朝欧美亚洲精品 | 国产精品中文字幕在线 | 久久久久久国产精品免费免费狐狸 | 国产福利免费观看 | 久久影院在线观看 | 综合久久亚洲 | 日本一区二区三区精品国产 | 久久院线 | 日夜啪 | 亚洲精品国偷拍自产在线观看 | 欧美理伦视频 | 日本中文字幕在线播放 | 操操操日日日干干干 | 国产男女免费完整版视频 | 亚洲成网 | 日本高清香蕉色视频在线观看 | 午夜精品久久久久久久久久久久久 | 成人影院欧美大片免费看 | 亚洲色域网 | 久久久国产一区二区三区 | 久久久一区二区 | 午夜精品毛片 | 欧美亚洲国产精品第一页 | 国产综合成色在线视频 | 色综合久久综合欧美综合 | 激情五月色婷婷 | 春色www在线视频观看 | 午夜视频一区二区三区 | 欧美日韩一区二区不卡 | 国产伦理久久精品久久久久 | 成人久久18免费游戏网站 | 亚洲欧美精品一区二区 | 性XXXX18精品A片一区二区 |