# Paging unix nerds, need help with mass file extension change

**URL:** https://forums.speedlife.net/t/paging-unix-nerds-need-help-with-mass-file-extension-change/162001
**Category:** NYSpeed Off Topic
**Created:** [October 27, 2010, 8:05am UTC](https://forums.speedlife.net/t/paging-unix-nerds-need-help-with-mass-file-extension-change/162001 "2010-10-27T08:05:29Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![neonglh](https://yyz2.discourse-cdn.com/flex034/user_avatar/forums.speedlife.net/neonglh/32/4951_2.png) [@neonglh](https://forums.speedlife.net/u/neonglh)
#### Post date: [October 27, 2010, 8:05am UTC](https://forums.speedlife.net/t/paging-unix-nerds-need-help-with-mass-file-extension-change/162001/1 "2010-10-27T08:05:29Z")

</div>

I have about 400 .htm files that I need to change to .html. There is absolutely no way that I am going to do this by hand. Does anyone know of any unix commands that would allow me to do this. I assume it’s in the realm of regular expressions.

I tried my luck and went with:

mv \*.htm \*.html

That did not work!

Let me know what would be my best bet. Thanks!

–mark

---

<div class="post-metadata">

### Author: ![boardjnky4](https://avatars.discourse-cdn.com/v4/letter/b/96bed5/32.png) [@boardjnky4](https://forums.speedlife.net/u/boardjnky4)
#### Post date: [October 27, 2010, 8:07am UTC](https://forums.speedlife.net/t/paging-unix-nerds-need-help-with-mass-file-extension-change/162001/2 "2010-10-27T08:07:14Z")

</div>

ugh, I know there is a way but I’m not remembering it, hold on

edit:

after a quick google search and a quick test

ls -d _.htm | sed 's/(._).htm$/mv “&” “\1.html”/’ | sh

simpler option:

for i in \* ; do mv “$i” `basename "$i" .htm`.html ; done

---

<div class="post-metadata">

### Author: ![itsJim](https://avatars.discourse-cdn.com/v4/letter/i/c67d28/32.png) [@itsJim](https://forums.speedlife.net/u/itsJim)
#### Post date: [October 27, 2010, 8:10am UTC](https://forums.speedlife.net/t/paging-unix-nerds-need-help-with-mass-file-extension-change/162001/3 "2010-10-27T08:10:45Z")

</div>

for i in \*.htm;  
do mv $i ${i%%.htm}.html;  
done

---

<div class="post-metadata">

### Author: ![neonglh](https://yyz2.discourse-cdn.com/flex034/user_avatar/forums.speedlife.net/neonglh/32/4951_2.png) [@neonglh](https://forums.speedlife.net/u/neonglh)
#### Post date: [October 27, 2010, 8:11am UTC](https://forums.speedlife.net/t/paging-unix-nerds-need-help-with-mass-file-extension-change/162001/4 "2010-10-27T08:11:34Z")

</div>

You sir, are the man!

Thank you much!

---

<div class="post-metadata">

### Author: ![ProgRocker](https://yyz2.discourse-cdn.com/flex034/user_avatar/forums.speedlife.net/progrocker/32/5434_2.png) [@ProgRocker](https://forums.speedlife.net/u/ProgRocker)
#### Post date: [October 27, 2010, 8:14am UTC](https://forums.speedlife.net/t/paging-unix-nerds-need-help-with-mass-file-extension-change/162001/5 "2010-10-27T08:14:01Z")

</div>

\<EDIT\> Problem solved I guess
