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

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第三方库


热门话题
java在Android Studio中使用while循环显示包含textview对象的数据   创建名为“userController”的bean时发生java错误:通过字段“userService”表示未满足的依赖关系   java PDFBox PDFImageWrite。writeImage未正确处理所有字符   java无法识别代码中的nzec错误   无法更改java TabLayout字体   在Java中使用子字符串删除部分字符串   Java中的listener addPropertyChangeListener方法   java可以同时拖动多个对象   java如何将数组中的值添加到向量中   java为什么在Camel 3.7.3中无法正确计算属性?   与后端问题不同的机器中的java客户端资源   带字符串的java分割字节数组?   java On_选项_项目_选择的方法说明   java如何在画布的父画中画一个圆?   连接超时和打开连接数的java Netty通道配置   java mysql中如何防止向数据库中插入重复数据   升级到macOS Big Sur后,java无法启动Neo4j控制台应用程序   在Java中使用XSLT将XML转换为HTMLString的ajax   java无法使用Apache POI获取Excel工作表中的数据