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

推荐订阅源

PCI Perspectives
PCI Perspectives
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
C
CXSECURITY Database RSS Feed - CXSecurity.com
P
Palo Alto Networks Blog
S
Schneier on Security
Scott Helme
Scott Helme
T
Threat Research - Cisco Blogs
K
Kaspersky official blog
Microsoft Azure Blog
Microsoft Azure Blog
T
The Exploit Database - CXSecurity.com
C
Cybersecurity and Infrastructure Security Agency CISA
T
Tenable Blog
G
GRAHAM CLULEY
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
I
Intezer
D
Docker
月光博客
月光博客
L
Lohrmann on Cybersecurity
Latest news
Latest news
B
Blog
罗磊的独立博客
M
MIT News - Artificial intelligence
S
Securelist
Know Your Adversary
Know Your Adversary
Help Net Security
Help Net Security
Recorded Future
Recorded Future
S
SegmentFault 最新的问题
N
Netflix TechBlog - Medium
T
Threatpost
H
Hacker News: Front Page
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
人人都是产品经理
人人都是产品经理
F
Fortinet All Blogs
博客园 - Franky
P
Proofpoint News Feed
大猫的无限游戏
大猫的无限游戏
Blog — PlanetScale
Blog — PlanetScale
有赞技术团队
有赞技术团队
博客园 - 【当耐特】
A
About on SuperTechFans
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
T
Tor Project blog
Google Online Security Blog
Google Online Security Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Engineering at Meta
Engineering at Meta
Webroot Blog
Webroot Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
Microsoft Security Blog
Microsoft Security Blog

博客园 - zim.NET

悼念友人 博客搬家了 函数调用中的黑客技术 3D学习笔记之一句话总结(不断更新中) 混乱你的代码 - zim.NET - 博客园 这么个女孩,你娶吗(转) 被误传了数千年的七句话(精简版_转载) 找工作故事之篇二 找工作故事之开篇 - zim.NET - 博客园 失落的阳光,陈酿的悲伤——许美静 一个空间换时间算法 求最长公共子序列 最小生成树算法讨论 用EditPlus打造你自己的IDE 将PPT内容导出为JPG图片 C/C++ 误区:fflush(stdin) 关于"extern" 闲谈成员初始化列表 脑筋急转弯3600题
一行命令解决批量重命名
zim.NET · 2007-10-12 · via 博客园 - zim.NET

因为要看linux内核源代码,太多不能在电脑上时时盯着看,所以准备把它放到MP4里看,可是现在的MP4多数只支持.txt格式的,所以要把那些.c和.h等都改一下名字.当然我们不可能一个个名字改.所以要用到批量重命名.
 
在windows下即使用ren *  *.txt也只能改一个文件夹内的文件,可是linux内核有很多文件夹,而ren  并没有提供递归办法.-r

写程序当然可以完成此任务,不过为改下名就写个程序有点杀鸡用牛刀了.
突然想念起linux shell.不过现在在windows下.就写个bat吧.写个bat文件也太小题大作,那就写一行命令吧.呵呵.
不过我们可以用一个for 来解决这一切咯.改这数以上万个文件,只要下面这一句话.
 
for /r . %a in (*) do @if not %~xa == .txt ren %a %~nxa.txt
 
以上的命令递归更改当前目录下的除.txt文件外的所有文件的文件名为*.txt
我在新的文件名中保存的原文件的扩展名,原因是对诸如hello.c 和hello.h 作重命名为hello.c.txt 和hello.h.txt 作一个区分而已.

NOte: 此改名命令有所危险,直接对原文件改名了.建议对原文件夹备份一份哦.出事可别找我咯..放心,改名不满意你就用这命令改回去咯.[for /r . %a in (*.txt) do  @ren %a %~na ]

愿对你有用.