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 regex?
Alternatively, you could install the
ren
(rename) utilityIf you want to rename files with prefix or suffix in file names
Based on the selected and most accurate answer above, here's a bash function for reusability:
Usage:
(I couldn't figure out how to get clean code formatting in a comment on that answer.)
For those of you guys who are not really good in programming you can check out this article on wiki how.
It shows many method of doing it that doesn't involve coding
and you can also check out this blogpost on changing file extensions.
It contains a console application that does all the stuffs for you.
You could use something like this:
Make a copy first!
No need to write a script for it just hit this command