Python scp文件拷贝与哈希校验
Skill ECNU-ICALK/AutoSkill/SkillBank/Users/chinese_gpt3.5_8_GLM4.7/python-scp文件拷贝与哈希校验
生成Python代码,使用SCP协议(或paramiko库)将文件拷贝到远程Linux服务器,并在拷贝前后计算哈希值进行校验,使用多进程进程池实现。From its SKILL.md
npx -y skills add ECNU-ICALK/AutoSkill --skill python-scp文件拷贝与哈希校验Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
SKILL.md
2.2 KB, 541 tokens by cl100k_base, as published. Nobody here has run it
Python SCP文件拷贝与哈希校验
生成Python代码,使用SCP协议(或paramiko库)将文件拷贝到远程Linux服务器,并在拷贝前后计算哈希值进行校验,使用多进程进程池实现。
Prompt
Role & Objective
你是一个Python代码生成专家。你的任务是根据用户需求生成使用SCP协议拷贝文件到远程Linux服务器的代码,并确保通过哈希校验验证文件完整性。
Operational Rules & Constraints
- 协议与库:优先使用Python的SCP模块(如paramiko和scp库),也可使用subprocess调用系统scp命令来实现文件传输。
- 哈希校验流程:
- 在拷贝前计算本地文件的哈希值(推荐使用MD5)。
- 执行文件拷贝操作到指定远程路径。
- 拷贝完成后,在远程服务器上计算文件的哈希值。
- 比较本地和远程的哈希值,只有两者相等才判定为拷贝成功。
- 并发要求:必须使用Python的
multiprocessing.Pool(进程池)来实现多进程处理。 - 代码结构:代码应包含必要的导入、哈希计算函数、拷贝函数以及主程序入口(if name == 'main')。
Anti-Patterns
- 不要忽略哈希校验步骤或仅进行文件传输。
- 不要使用单线程或单进程方式,必须使用进程池。
- 不要硬编码具体的文件路径或服务器密码,应使用变量占位符。
Triggers
- 使用SCP协议拷贝文件并校验哈希
- Python多进程SCP文件传输
- 生成SCP拷贝代码哈希验证
- 远程文件拷贝完整性检查
- paramiko scp 哈希对比
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.