递归地扫描一个或多个给定的目录以查找重复的文件。

yadupe的Python项目详细描述


重复播放

yadupe是另一个在系统中查找和删除重复文件的工具。 它将递归地读取源目录,查找重复的文件。如果两个文件具有相同的大小和内容,则被视为重复文件,尽管它们可能具有不同的名称。

在搜索模式实用程序报告重复文件列表。

在重复数据消除模式下,实用工具会将重复文件移动到给定的目标目录中。源目录中只保留一组重复项中的一个文件。此外,包含移动副本的所有路径的报告文件将保存在目标目录中。

先决条件

安装

% pip install yadupe

如果没有pip,安装也很容易:https://pip.pypa.io/en/stable/installing/

安装yadupe后,可以在cli上使用它:

% yadupe -h

用法

  1. 搜索并删除目录/home/user/source_a/home/user/source_b中的重复文件。找到的重复项将移动到/home/user/duplicates,以及有关移动文件的报告。也删除了source_asource_b中的空子文件夹。
% yadupe /home/user/source_a /home/user/source_b -d -p -r /home/user/duplicates
  1. 在目录/home/user/source_a中搜索重复项并打印重复列表。
% yadupe /home/user/source_a
  1. 在python应用程序的examples目录中有两个使用yadupe包的示例。

选项

% yadupe -h

usage: yadupe [-h] [-d] [-p] [-r PATH] PATH [PATH ...]

Recursively scan one or more given directories for duplicate files. Found
duplicates list could be saved into report or printed out in console. Also,
duplicates could be moved into destination directory in safe way, preserving
it relative path. In this case file name is written in the report, as well as
new path for the file. If empty sub-directories turn up after duplicates
removal, the could be deleted as well.

positional arguments:
  PATH                  Source path to search duplicated files.

optional arguments:
  -h, --help            show this help message and exit
  -d, --deduplicate     Scan and remove mode. Duplicates will be moved into
                        given directory.
  -p, --purge           Remove empty subdirs after duplicates move.
  -r PATH, --result PATH
                        Path to report dir (optional for default search mode)
                        OR directory to move duplicated files into.

测试

要在test目录中运行单元测试,请首先在test-data.zip目录中的test-data存档文件中解压缩。它为测试创建所需的目录树。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
我可以用C++代码使用java代码吗?   java使用JSR303在派生类中提供更具体的约束   java在这个查找唯一路径数算法中我做错了什么?   java如何为2个不同的服务提供商使用2个不同的SSL证书?   java在Gridview上绘制文本   java使用连接for循环构建字符串名   java StringBuilder拆分无法处理某些文件   java事件关注EditText   Java Web Start“找不到URL的缓存资源”   java程序从命令行运行的速度比在Eclipse中慢   java为什么HttpServletRequest会截断#字符上的url输入?   java自定义折叠工具栏平滑标题大小调整   使用Mockito对安卓 java中调用另一个静态函数的函数进行单元测试   http在java客户机中使用cachecontrol头   java如何使用。是否使用Delimiter从输入文件中排除标点符号和数字?   使用上下文作为参数/参数的java   java更有效地从Jar中提取文件   java为多个JButton提供相同的actionListener