Obtaining the attributes and properties of a folder recursively.

Tim Golden mail at timgolden.me.uk
Sat Mar 21 11:05:07 CET 2009

venutaurus539 at gmail.com wrote:
> Thank you Sir for your reply. It is working for me. But is failing if
> I have Unicode characters in my path. I tried giving a 'u' in front of
> the path but still it fails at f.createdat. Does it support Unicode
> Characters?
> This the traceback which I got while running the above python script
> on my data:
> -----------------------------------
> \\?\C:\JPDump\AGIT_FSDM\Unicode\Arabic files\Arabicְדזךמאּשּׁתּ
> פּפֿשּﭏכּטּךּאָשּׁבֿפֿװײ״טצתא

In fact, to give me something to test against, would you
be able to send me the result of running this code, please?
It's just listing the names of the files under that particular
directly, encoded as utf8 so they'll survive transit:

import os
from winsys import fs

PATH = r"\\?\C:\JPDump\AGIT_FSDM\Unicode\Arabic files"
f = open ("arabic-files.txt", "wb")
for filename in fs.listdir (PATH):
  f.write (filename.encode ("utf8") + "\r\n")

f.close ()
os.startfile ("arabic-files.txt")



More information about the Python-list mailing list