Tim Chase wrote, in part:
> ...
> I've found that Win32 doesn't often take a rename if the origin
> and destination differ only in case[*]. Thus, to change the
> case, I've had to do *two* renames...one to, say, prefix with an
> underscore and change the case to my desired case, and then one
> to
Tim Chase wrote:
> Having a win32 program take case-sensitive filenames is a bit
> odd, given that the OS is case-agnostic...however, that doesn't
> preclude bad programming on the part of your tool-maker. Alas.
>
> Thus, to accomodate the lousy programming of your tool's maker, I
> proffer thi
>> can you post an example of a filename that misbehaves on
>> your machine?
>>
>>
>
> To Fredrik Lundh and Tim Chase:
>
> My task was read all tga file names and generate a config xml
> file, then pass this xml file to a utility, but this utillity
> only read files with extension 'tga' than 'T
Fredrik Lundh wrote:
> that's not how splitext works, though:
>
> >>> os.path.splitext("FOO.BAR")
> ('FOO', '.BAR')
>
> can you post an example of a filename that misbehaves on your machine?
>
>
To Fredrik Lundh and Tim Chase:
My task was read all tga file names and generate a config xml file,
t
>>> fullname = name[:len(name) - 1] + ext.lower()
>> are you sure you want to strip off the last character in the actual
>> filename? should "FOO.BAR" really be turned into "FO.bar" ?
>> name[:len(name) - 1] can be written name[:-1], btw.
>>> os.rename(os.path.join(path, f
Tiefeng Wu wrote:
> strip off the last character because if simply add name
> and ext I got result like "FOO..bar", there are two dots.
that's not how splitext works, though:
>>> os.path.splitext("FOO.BAR")
('FOO', '.BAR')
can you post an example of a filename that misbehaves on your machine?
Fredrik Lundh wrote:
> > fullname = name[:len(name) - 1] + ext.lower()
> are you sure you want to strip off the last character in the actual
> filename? should "FOO.BAR" really be turned into "FO.bar" ?
> name[:len(name) - 1] can be written name[:-1], btw.
> > os.rename(os
Tiefeng Wu wrote:
> I need make all files extension to lower by a given directory.
> Here is my solution:
>
> import os
>
> def make_all_file_ext_lower(root):
> for path, subdirs, files in os.walk(root):
> for file in files:
> (name, ext) = os.path.splitext(file)
the par