April 27, 2007

You know you're getting old when...

You decide to do a small python script to do something you could do using find and pax.


import os
for file in os.listdir("."):
if file.startswith("3.x"):
os.rename(file,"x"+file[2:])

(This changes the filename of all files from the current directory from "3.x*" to "x*").

3 comments:

  1. Anonymous7:10 PM

    Python?! find?! pax?! Dasse... Shell script à homem!!!:

    for f in 3.x*
    do
    t=`echo $f | cut -c3-`
    mv $f $t
    done


    -- MV

    ReplyDelete
  2. Anonymous6:42 AM

    how do you actually do it using pax and find?

    ReplyDelete