以下是一个Python3脚本,它使用subprocess模块来调用rhash命令,并批量计算打印文件的ed2k链接。

import os
import subprocess

# 指定要计算ed2k链接的目录
directory = "/path/to/directory"

# 获取目录中的所有文件
files = os.listdir(directory)

for file in files:
    # 仅处理文件
    if os.path.isfile(os.path.join(directory, file)):
        # 调用rhash命令
        result = subprocess.run(["rhash", "-L", os.path.join(directory, file)], capture_output=True, text=True)

        # 解析ed2k链接
        output = result.stdout.split("\n")
        for line in output:
            if "ed2k://" in line:
                print(line)

这个脚本遍历指定目录中的所有文件,并使用rhash命令计算它们的ed2k链接。然后,它打印所有找到的链接。

编写一个python3利用rhash -L命令参数批量计算打印文件ed2k链接的脚本

原文地址: https://www.cveoy.top/t/topic/bbXI 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录