simple renaming files program

Peter Otten __peter__ at web.de
Mon Aug 9 16:06:50 EDT 2010


Chris Rebert wrote:

> On Mon, Aug 9, 2010 at 3:19 AM, Peter Otten <__peter__ at web.de> wrote:

>> Warning: I don't remember how Windows handles this, but unix will happily
>> perform os.rename("alpha/alpha.txt", "beta/beta.txt") and overwrite
>> beta/beta.txt with alpha/alpha.txt.
>>
>> I'd rather modify the filename before joining it with the directory.
> 
> Er, unless I'm really missing something, that's what my code already
> does. Perhaps you misread it? The replace() clearly happens before the
> 2nd join(). I took special care to account for and avoid the potential
> problem you're talking about.

You're right. Sorry for the confusion.

Peter



More information about the Python-list mailing list