Thursday, February 26, 2009

renaming files on Mac OS X with ruby

So, for example you have bunch of ".htm" files that you want to rename to ".html"

You need to open your Terminal.app "cd" to the directory where you files are and run this command:
ruby -e "Dir.glob('*.htm').each{|file| File.rename(file,file.gsub('.htm', '.html'))}"

If you want it to work for a current and all recursive directories you need to make a simple change:
ruby -e "Dir.glob('**/*.htm').each{|file| File.rename(file,file.gsub('.htm', '.html'))}"

2 comments:

sailerkafka said...

The Best Real Money Casinos | Complete list of casinos in 2021
1. Ignition Casino – $400 Bonus + 250 free spins + 20 free spins. 2. Café 먹튀검증업체 순위 Casino – $100 한게임 포커 apk Bonus + 20 한게임바카라 free spins + 20 다 파벳 모바일 free spins. 3. Super Slots – $1,000 Bonus 실시간 바카라 + 20

Anonymous said...

If you wish to go slightly further away from the world of Ancient Egypt, 카지노사이트.online then Pragmatic Play's Wolf Gang will transport you to the mystical universe with an RTP of ninety six.01%. You will find hundreds of free on-line slots at licensed casinos in the US. Leading developers include IGT, NetEnt, Bally, and WMS, all of whom supply world-beating video slots.