Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →
class method
File.chmod
File.chmod(mode_int, file_name, ... ) → integer
file.c
View on GitHub ↗
static VALUE
rb_file_s_chmod(int argc, VALUE *argv, VALUE _)
{
mode_t mode;
apply2args(1);
mode = NUM2MODET(*argv++);
return apply2files(chmod_internal, argc, argv, &mode);
}
Changes permission bits on the named file(s) to the bit pattern represented by mode_int. Actual effects are operating system dependent (see the beginning of this section). On Unix systems, see chmod(2) for details. Returns the number of files processed.
Example
File.chmod(0644, "testfile", "out") #=> 2