# py2tools **Repository Path**: soloxyq/py2tools ## Basic Information - **Project Name**: py2tools - **Description**: 过时的, 老的, 常用的脚本 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-07-23 - **Last Updated**: 2026-07-23 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # py2tools py2tools 是一个用于处理文件时间戳的工具集,当前主要包含 `fixtime` 模块,用于扫描目录并修复文件的时间戳信息。 ## 功能特性 - **文件时间戳读取**:支持读取文件的创建时间、修改时间等时间戳信息 - **时间格式转换**:提供 Windows FILETIME、SYSTEMTIME 与常用时间戳之间的转换功能 - **目录扫描**:可递归扫描目标目录,分析文件时间戳状态 - **修复计划生成**:根据扫描结果自动生成时间戳修复计划 - **批量修复**:支持批量应用修复计划,统一调整文件时间戳 - **报告生成**:扫描完成后可生成详细的时间戳报告 - **预览与备份**:修复前支持预览更改,并自动备份原始状态 ## 环境要求 - Python 2.7 / Python 3.x - Windows 操作系统(部分功能依赖 Windows API) ## 安装方法 ```bash # 克隆仓库 git clone https://gitee.com/soloxyq/py2tools.git # 进入目录 cd py2tools ``` ## 使用方法 ### 基本用法 ```bash # 扫描目录并生成报告 python fixtime.py /path/to/target/directory # 扫描并预览修改(不实际应用更改) python fixtime.py /path/to/target/directory --preview # 扫描并应用修复 python fixtime.py /path/to/target/directory --fix ``` ### 常用参数 | 参数 | 说明 | |------|------| | `--preview` | 预览模式,仅显示将要进行的修改 | | `--fix` | 执行修复操作 | | `--report` | 生成详细的时间戳报告 | | `--recursive` | 递归扫描子目录 | ## 模块说明 ### fixtime.py 核心模块,包含以下主要函数: - `get_path_times(path)`:获取路径的时间戳信息 - `set_dir_times(path, creation_ticks, modification_ticks)`:设置目录时间戳 - `calculate_rebuild_plan(target_dir)`:计算时间戳修复计划 - `apply_rebuild_plan(pending)`:应用修复计划 - `build_report_lines(target_dir, result)`:生成报告内容 ## 许可证 本项目遵循开源许可证,具体信息请查看 LICENSE 文件。 ## 贡献指南 欢迎通过 Issue 或 Pull Request 贡献代码,请确保提交前进行充分测试。 ## 联系方式 - 项目地址:https://gitee.com/soloxyq/py2tools - 问题反馈:请在 Gitee Issue 中提交