|
Programming HowTo's -
Python HowTo's
|
|
Written by Allen Sanabria
|
|
Monday, 28 April 2008 22:30 |
#!/usr/bin/env python #Created by LinuxDynasty import os, re, sys
os.chdir(sys.argv[1]) ls = os.listdir('./') for file_o in ls: file_n = re.sub("\w\.", ".", file_o) os.rename(file_o, file_n)
print os.listdir("./")
To run this script you will do this.
python <script> <"directory">
python rename1.py "/home/dynasty/test"
|
|
Last Updated ( Wednesday, 14 May 2008 11:57 )
|