[Haskell-cafe] Filesystem access

Esa Ilari Vuokko eivuokko at gmail.com
Thu Jun 21 21:08:06 EDT 2007

On 6/21/07, Andrew Coppin <andrewcoppin at btinternet.com> wrote:
> OK, a few questions...
> 1. Is there *any* way to determine how large a file is *without* opening
> it? The only library function I can find to do with file sizes is
> hFileSize; obviously this only works for files that you have permission
> to open!

I think you must open file in Windows to get the size for it, but I am not
100% sure.  (That might be the reason you see sometimes files that
are just created with size 0 even as process writes to them - file is locked.)

> 2. Is there any way to discover Windoze-style "attributes" for files?
> (Read-only, archive, system, hidden, et al.)

Fraser posted some functions to help with this.  However, those attributes are
mostly outdated unless you are workin on old Windows.  For real file rights,
more in line with traditional unix right would be file ACLs.  (There's useful
flags there, too.)  Unfortunately Security api isn't in Win32 package.

Best regards,

More information about the Haskell-Cafe mailing list