更改 OS X 上目录中所有文件的文件扩展名 [英] Changing file extensions for all files in a directory on OS X
本文介绍了更改 OS X 上目录中所有文件的文件扩展名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个包含一个扩展名(在本例中为 .txt)的文件的目录,我想将其自动转换为另一个扩展名(.md).
I have a directory full of files with one extension (.txt in this case) that I want to automatically convert to another extension (.md).
是否有一个简单的单行终端可以用来将这个目录中的所有文件转换为不同的文件扩展名?
Is there an easy terminal one-liner I can use to convert all of the files in this directory to a different file extension?
或者我需要写一个带有正则表达式的脚本吗?
Or do I need to write a script with a regular expression?
推荐答案
你可以这样使用:
for old in *.txt; do mv $old `basename $old .txt`.md; done
先复制一份!
这篇关于更改 OS X 上目录中所有文件的文件扩展名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文