waling a directory with very many files
Hrvoje Niksic
hniksic at xemacs.org
Mon Jun 15 08:00:02 EDT 2009
Nick Craig-Wood <nick at craig-wood.com> writes:
> Here is a ctypes generator listdir for unix-like OSes.
ctypes code scares me with its duplication of the contents of system
headers. I understand its use as a proof of concept, or for hacks one
needs right now, but can anyone seriously propose using this kind of
code in a Python program? For example, this seems much more
"Linux-only", or possibly even "32-bit-Linux-only", than "unix-like":
> class c_dirent(Structure):
> """Directory entry"""
> # FIXME not sure these are the exactly correct types!
> _fields_ = (
> ('d_ino', c_long), # inode number
> ('d_off', c_long), # offset to the next dirent
> ('d_reclen', c_ushort), # length of this record
> ('d_type', c_byte), # type of file; not supported by all file system types
> ('d_name', c_char * 4096) # filename
> )
More information about the Python-list
mailing list