regexp and filenames

hokiegal99 hokiegal99 at hotmail.com
Tue Jul 8 20:24:42 EDT 2003


I have a bit of a problem that I think Python can solve, but I need a 
bit of direction. I'm replacing 12 Macs with PCs. Macs allow characters 
in filenames that Windows does not, specifically the following:

: * ? " < > | / \

I would like to write a script that searches through a directory for 
filenames that contain any of the aboved listed characters and replaces 
them with a - (the minus sign).

I'm familiar with regexp, but I've only used it in Python to act on the 
contents of a file, not filenames in a directory. Any pointers on how to 
approach this are welcome!





More information about the Python-list mailing list