Thanks! That's os.path.basename() I guess. It's better, but still complex.
I have a _nof_ = argv[0].split(sep)[-1] in my script template and use it under the usage() function to tell what the script does, like: "cf.py counts files in directory or directory structure" If I change the filename, I want it to be automatically reflected when running the script. That's the motivation. I have the feeling that I came a cross some very simple way to extract the filename, but I can't find my mental note ;-) -- http://mail.python.org/mailman/listinfo/python-list