Samstag, 4. Dezember 2010

Batch File Renaming with Python

I bet everyone has already had this problem. You have a couple of hundreds of files (e.g. photos) and want to rename them all at once using some pattern.

I woke up today and asked myself, why not write a small python script. Here it is:



  1. #!/usr/bin/env python
  2. import re
  3. import os
  4. # regex matching the file name blablaqwe123456.txt
  5. regex = '^s_Entrepreneurship_Corner_Podcasts_(\S+)(\d\d)(\d\d)(\d\d)\.(txt)$'
  6. # prepare the regex
  7. r = re.compile(regex)
  8. # list files in the current directory
  9. all = os.listdir('.')
  10. for fname in all:
  11. m = r.match(fname)
  12. if m:
  13. # extract the different parts from the old name
  14. name = m.group(1)
  15. year = "20" + m.group(2)
  16. month = m.group(3)
  17. day = m.group(4)
  18. ext = m.group(5)
  19. # create the new name
  20. newfname = year + "-" + month + "-" + day + "-" + name + "." + ext
  21. # rename the file
  22. print "renaming " + fname + " to " + newfname + "..."
  23. os.rename(fname, newfname)

Feel free to use it!

Donnerstag, 29. Oktober 2009

Sonntag, 25. Oktober 2009

Quotations

Guys, I'm burnt out... I implemented a huge bulk of functionality over the weekend. It's still not completely done and also not really visible... It's just one drop-down box in principle.

You can now choose what kind of text you'd like to type (not yet available in the multiplayer mode). The possible types are random text and quotations. Quotations are texts I copy&pasted from amazon from different books and their descriptions.

I really hope this will make the game more fun! So, let's typerace, folks!

Sonntag, 27. September 2009

Historical High

Thursday, September 24th was a historical high of the visitor count: 197!
The reason were a couple of links in popular blogs.
I still haven't found a sustainable marketing strategy, but I have a hope that I'm on a right way...

Freitag, 18. September 2009

5 players online!

Folks, I have visitors! Look:

Mittwoch, 26. August 2009

typeracing.net

After a long period of nothing, the ultimative typeracing version two dot oh has been released. The product has been totally re-designed and partially re-implemented (e.g. the server technology has been changed from PHP to Java). New architecture will provide a solid base for various extensions.

Here are the highlights:
  • Multiplayer mode: You can now play with your friends
  • Chat: There's a live chat in the mulitplayer lounge
  • Internatiolization: An english version of typeracing is now available.
The future plans are:
  • Further languages (Russian, French, Spanish, Chinese)
  • Registration
  • Expansion onto each desktop and replacement of competitors like google, amazon, facebook, microsoft and others :D
Links:
See you!

Donnerstag, 13. November 2008

typeracing.de

Hello world!

Meine neue Webseite ist online: www.typeracing.de! Ich bin gespannt wie lange es dauert bis Google diesen Link findet...

Die Anzahl der Besucher steigt aber auch ohne google mit unglaublicher Geschwindigkeit: von 8 Besucher vorgestern auf 11 gestern!!!

:-]