static public Method

File.chmod(...)

File.chmod(mode_int, file_name, ... )  integer

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.

File.chmod(0644, "testfile", "out")   #=> 2

Source Code

/*
*  call-seq:
*     File.chmod(mode_int, file_name, ... ) -> integer
*  
*  Changes permission bits on the named file(s) to the bit pattern
*  represented by <i>mode_int</i>. Actual effects are operating system
*  dependent (see the beginning of this section). On Unix systems, see
*  <code>chmod(2)</code> for details. Returns the number of files
*  processed.
*     
*     File.chmod(0644, "testfile", "out")   #=> 2
*/

static VALUE
rb_file_s_chmod(argc, argv)
   int argc;
   VALUE *argv;
{
   VALUE vmode;
   VALUE rest;
   int mode;
   long n;

   rb_secure(2);
   rb_scan_args(argc, argv, "1*", &vmode, &rest);
   mode = NUM2INT(vmode);

   n = apply2files(chmod_internal, rest, &mode);
   return LONG2FIX(n);
}
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.