文件管理自动化工具
organize-tool的Python项目详细描述
组织
文件管理自动化工具。
通过pip安装(要求:python 3.4+):
在MacOS/Windows上: $ pip3 install organize-tool
在Linux上: $ sudo pip3 install organize-tool
完整的文档位于https://organize.readthedocs.io/。
为什么你会觉得这个有用
你的桌面一团糟?你在下载中找不到任何东西 文件?手工对所有这些文件进行排序和重命名是不是太繁琐了? 是时候让它自动化一次并永远受益于它了。
organize是一个命令行,是hazel(macos)等应用程序的开源替代品。 或者文件杂耍者(windows)。
在shell中,运行$ organize config编辑配置:
config.yaml:
rules:# move screenshots into "Screenshots" folder-folders:-~/Desktopfilters:-filename:startswith:'ScreenShot'actions:-move:~/Desktop/Screenshots/# move incomplete downloads older > 30 days into the trash-folders:-~/Downloadsfilters:-extension:-download-crdownload-part-lastmodified:days:30mode:olderactions:-trash
(或者,您可以运行$ organize config --path查看 您的config.yaml)
$ organize run现在…
- 将所有屏幕快照从桌面移到“屏幕快照”子文件夹 (如果不存在该文件夹,将创建)
- 将超过30天的所有未完成下载放入垃圾桶
就这么简单。
感到不安全?运行$ organize sim查看如果没有 触摸你的文件。
但还有更多。要重命名/复制文件,运行自定义shell或python 脚本、将文件名与正则表达式匹配或使用占位符变量? 你有没有参加过。
高级使用示例
此示例显示了一些高级功能,如占位符变量、可插入 通过子文件夹的操作和递归:
rules:-folders:~/Documents/**/*filters:-extension:-pdf-docx-lastmodifiedactions:-move:'~/Documents/{extension.upper}/{lastmodified.year}-{lastmodified.month:02}/'-shell:'open"{path}"'
假设我们的~/Documents文件夹(或其任何子文件夹)中有两个文件 从2018年1月起命名为^{TT10}$,从2016年12月起命名为^{TT11}$。 发生时间:
- script.docx将移动到~/Documents/DOCX/2018-01/script.docx
- demo.pdf将移动到~/Documents/PDF/2016-12/demo.pdf
- 这些文件将从它们的新位置打开(opencommand in macos)。
命令行界面
The file management automation tool. Usage: organize sim [--config-file=<path>] organize run [--config-file=<path>] organize config [--open-folder | --path | --debug] [--config-file=<path>] organize list organize --help organize --version Arguments: sim Simulate a run. Does not touch your files. run Organizes your files according to your rules. config Open the configuration file in $EDITOR. list List available filters and actions. --version Show program version and exit. -h, --help Show this screen and exit. Options: -o, --open-folder Open the folder containing the configuration files. -p, --path Show the path to the configuration file. -d, --debug Debug your configuration file. Full documentation: https://organize.readthedocs.io