You can change the owner and group of a file with the chown method : chown « File Directory « Ruby






You can change the owner and group of a file with the chown method


# It is like the Unix/Linux command chown. 
# You need superuser or root privileges to use this method.

file = File.new( "books.txt", "r" )
file.chown( 109, 3333 )

# or: 

file = File.new( "books.txt", "r" ).chown( 109, 3333 )

 








Related examples in the same category