Freaky_Chris 299 Master Poster

Hope it works for you, like i say we can always change it.

Congratulations, with the new born.

Chris

Freaky_Chris 299 Master Poster

lol thanks for pointing that out, i've updated it to avoid confusion. In actually fact although it is bad, in that example it will work fine. The only time you will have a problem with that is if you do something liek "C:\", which will be obvious when you do it that it is an error.

Chris

Freaky_Chris 299 Master Poster
import os
folderA = []
for path, dirs, files in os.walk("C:\\Folder A"):
   for f in files:
      folderA.append(f)

i = 0

for path, dirs, files in os.walk("C:\\Folder B"):
   for f in files:
      os.rename(f, folderA[i])
      i += 1

Something like that should work nicely for you. Not tested so if it doesn't work just post back xD

Chris

Freaky_Chris 299 Master Poster

Hey, im having a problem retrieving information about some files due to the fact either the file name or the extension is too long.

For example i want to retrieve the size of a file only i call

os.path.getsize("somelongfilename.txt")

Note that it may not be a .txt extension, but it normall no longer than a 3 character extension.

And i get the following error

WindowsError: [Error 206] The filename or extension is too long:

Is there away around this?

Thanks,
Chris

Mark Carlson commented: great post +0