惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
The GitHub Blog
The GitHub Blog
F
Fortinet All Blogs
Cloudbric
Cloudbric
P
Palo Alto Networks Blog
T
Threatpost
T
Tor Project blog
T
Tenable Blog
AWS News Blog
AWS News Blog
Project Zero
Project Zero
L
LangChain Blog
Cyberwarzone
Cyberwarzone
Engineering at Meta
Engineering at Meta
雷峰网
雷峰网
C
CERT Recently Published Vulnerability Notes
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Security Latest
Security Latest
云风的 BLOG
云风的 BLOG
I
Intezer
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
P
Proofpoint News Feed
A
Arctic Wolf
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Google DeepMind News
Google DeepMind News
V
Vulnerabilities – Threatpost
C
Cybersecurity and Infrastructure Security Agency CISA
MongoDB | Blog
MongoDB | Blog
aimingoo的专栏
aimingoo的专栏
K
Kaspersky official blog
Jina AI
Jina AI
N
News | PayPal Newsroom
T
The Blog of Author Tim Ferriss
D
DataBreaches.Net
A
About on SuperTechFans
博客园 - 三生石上(FineUI控件)
博客园 - 【当耐特】
Hugging Face - Blog
Hugging Face - Blog
Recorded Future
Recorded Future
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
S
Secure Thoughts
TaoSecurity Blog
TaoSecurity Blog
P
Privacy & Cybersecurity Law Blog
P
Proofpoint News Feed
MyScale Blog
MyScale Blog
IT之家
IT之家
Forbes - Security
Forbes - Security
The Hacker News
The Hacker News
Last Week in AI
Last Week in AI
T
Threat Research - Cisco Blogs
Y
Y Combinator Blog

拓源网

微信和QQ访问页面提示使用右上角浏览器打开 - 拓源网 [反调试]审查元素清空页面或重定向 - 拓源网 使用Python移除PDF编辑权限密码 - 拓源网 写一款《PPT将指定页面另存为》小工具 - 拓源网 让jquery代码只能在指定域名下运行的三种方法 - 拓源网 PPT拼图批量生成工具 - 拓源网 Deepseek微信聊天机器人 - 拓源网 使用Python自动抓取zblog文章到腾讯云大模型知识引擎LKE,投喂数据专属化自己的知识库 - 拓源网 deepseek生图指令 - 拓源网
批量替换文件名的powershell脚本 - 拓源网
2025-08-05 · via 拓源网

我们常常在按Ctrl键用鼠标单击选择多个文件时,不小心手抖或者鼠标不灵敏,会复制出来很多副本文件,第一时间Ctrl+Z可以撤销操作,当后续进行了其他操作回来再处理这些副本文件,可以用以下powershell脚本,将所有带“ - 副本”名称的文件全部删除。

打开需要批量替换文件名所在的文件夹,按住Shift键,右键点击文件夹空白处,选择“在此处打开 PowerShell 窗口”。

运行以下命令:

Get-ChildItem -File -Recurse | Where-Object { $_.Name -like "* - 副本*" } | Remove-Item

当然可以指定文件类型,如jpg文件:

Get-ChildItem -Filter *.jpg | Where-Object { $_.Name -like "* - 副本*" } | Remove-Item

如果不存在重复文件的情况,只希望批量修改文件名,可以用以下命令:

Get-ChildItem -Filter *.jpg | Rename-Item -NewName { $_.Name -replace " - 副本", "" }

这条命令会遍历当前文件夹下所有.jpg文件,并把文件名中的“ - 副本”字样删除,可自行修改需要替换的文件扩展名和要替换的文字内容。

需要注意的是,文件夹路径不能含有特殊字符。