使用 Powershell 删除重复文件 [英] Removing duplicate files with Powershell

查看:88
本文介绍了使用 Powershell 删除重复文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几千个重复文件(例如 jar 文件),我想使用 powershell 来

I have several thousand duplicate files (jar files as an example) that I'd like to use powershell to

  1. 递归搜索文件系统
  2. 查找重复项(仅按名称或校验和方法或两者)
  3. 删除除一个之外的所有重复项.

我是 powershell 的新手,我把它扔给了可能会提供帮助的 PS 人员.

I'm new to powershell and am throwing this out there to the PS folks that might be able to help.

推荐答案

试试这个:

ls *.txt -recurse | get-filehash | group -property hash | where { $_.count -gt 1 } | % { $_.group | select -skip 1 } | del

来自:http:///n3wjack.net/2015/04/06/find-and-delete-duplicate-files-with-just-powershell/

这篇关于使用 Powershell 删除重复文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆