Regards,
Tammo
> Currently I use an
> system("chmod -R u+X example_dir") and I would like to know if there is
> a way to do that "naturally" in ruby.
A combination of Pathname.glob('example_dir/**') and Something.chmod(0766)
But then propably all files below example_dir would have the same file
permission. What I would like to accomplish is to change only one bit of
the permissions. E.g. with something like
-rw-r--r-- file1
-rwxr--r-- file2
-r-xr-x--- file3
and I want to add group write permission I would get
-rw-rw-r-- file1
-rwxrw-r-- file2
-r-xrwx--- file3
But when I use something like chmod(0766) all files have the same file
permissions afterwarts. But maybe some of them shall stay executable and
some not.
Regards,
Tammo
You should use File.stat('filename').mode, a bitmask, and a bitwise
'and'.
--
Posted via http://www.ruby-forum.com/.