From: Daniel Berger Date: 2006-11-17T22:45:08+09:00 Subject: Re: Changing permission on a file App Ra wrote: > I'm trying to change permission on a file on a windows machine. This > should work according to the documentation (may be i'm missing something > here). But it doesn't > here is the code: > > # take away read permission > new_permission = File.lstat("testfile").mode ^ 0004 > File.chmod(new_permission, "testfile" ) > File.readable?("testfile") #=> true Windows only supports two modes for File.chmod - 0644 (read/write) or 0444 (readonly). You can use advanced attribute and security settings with the win32-file package. However, you cannot make a file unreadable on Windows except perhaps through ACL. Regards, Dan PS - File.lstat is the same as File.stat on Windows.