将具有给定扩展名的所有文件从一个目录及其子文件夹复制到另一个目录。
slcp的Python项目详细描述
选择性复制v0.3.0
简单的命令行应用程序,将具有给定扩展名的所有文件从一个目录及其子文件夹复制到另一个显示进度条和剩余文件计数器的目录。
允许保留源文件夹结构、仅处理不带给定扩展名的文件、移动文件而不是复制、从处理中排除某些文件以及在必要时创建日志。
如果命令行中未给出源和/或目标,则打开文件对话框。
如果目标路径不存在,则创建文件夹。
安装
pip install slcp
用法
slcp ext [ext ...] [-s SRC] [-d DST] [-sc | -dc] [-p] [-i] [-m] [-e FILE [FILE ...]] [-l] [-h] Positional arguments: ext One or more extensions of the files to copy. Enter extensions without a dot and separate by spaces. Optional arguments: -s SRC, --source SRC Source folder path. -d DST, --dest DST Destination folder path. -sc, --srccwd Use current working directory as a source folder. -dc, --dstcwd Use current working directory as a destination folder. -p, --preserve Preserve source folder structure. -i, --invert Process only files without given extensions. -m, --move Move files instead of copying, be careful with this option. -e FILE [FILE ...], Exclude one or more files from processing. --exclude FILE [FILE ...] Enter filenames with extensions and separate by spaces. -l, --log Create and save log to the destination folder. -h, --help Show this help message and exit.
示例
更改日志
v0.3.0-2019-08-22
已添加
- Black代码样式
已更改
- 代码现在被分成几个单独的模块
- 带有扩展名的点将从输出文件夹名称中删除。 原因是名称以点开头的文件夹在Linux上被认为是隐藏的。
- 日志保存指示
- 日志文件的名称
已修复
- 当/home/user/test和/home/user/test2等路径被认为是嵌套的导致错误时出现问题。
v0.2.1-2019-07-16
已添加
- 更改日志
已修复
v0.2.0-2019-07-15
已添加
- 支持同时处理多个扩展
- --反转选项
- --移动选项
- --排除选项
许可证
这个项目是在麻省理工学院的许可下授权的-请参见LICENSE文件以了解详细信息
致谢
灵感来自Chapter 9 of Automate the Boring Stuff的任务。