D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
FileUtils
/
Filename :
install-c.ri
back
Copy
U:RDoc::AnyMethod[iI"install:ETI"FileUtils::install;TT:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"Copies a file entry. ;TI"LSee {install(1)}[https://man7.org/linux/man-pages/man1/install.1.html].;To:RDoc::Markup::BlankLine o; ; [I":Arguments +src+ (a single path or an array of paths) ;TI" and +dest+ (a single path) ;TI"Kshould be {interpretable as paths}[rdoc-ref:FileUtils@Path+Arguments];;T@o; ; [I"HIf the entry at +dest+ does not exist, copies from +src+ to +dest+:;T@o:RDoc::Markup::Verbatim; [ I"+File.read('src0.txt') # => "aaa\n" ;TI")File.exist?('dest0.txt') # => false ;TI"0FileUtils.install('src0.txt', 'dest0.txt') ;TI"+File.read('dest0.txt') # => "aaa\n" ;T:@format0o; ; [I"IIf +dest+ is a file entry, copies from +src+ to +dest+, overwriting:;T@o;; [ I")File.read('src1.txt') # => "aaa\n" ;TI")File.read('dest1.txt') # => "bbb\n" ;TI"0FileUtils.install('src1.txt', 'dest1.txt') ;TI")File.read('dest1.txt') # => "aaa\n" ;T; 0o; ; [I"MIf +dest+ is a directory entry, copies from +src+ to <tt>dest/src</tt>, ;TI"overwriting if necessary:;T@o;; [ I".File.read('src2.txt') # => "aaa\n" ;TI".File.read('dest2/src2.txt') # => "bbb\n" ;TI",FileUtils.install('src2.txt', 'dest2') ;TI".File.read('dest2/src2.txt') # => "aaa\n" ;T; 0o; ; [I"EIf +src+ is an array of paths and +dest+ points to a directory, ;TI"<copies each path +path+ in +src+ to <tt>dest/path</tt>:;T@o;; [I"&File.file?('src3.txt') # => true ;TI"&File.file?('src3.dat') # => true ;TI"FileUtils.mkdir('dest3') ;TI":FileUtils.install(['src3.txt', 'src3.dat'], 'dest3') ;TI",File.file?('dest3/src3.txt') # => true ;TI",File.file?('dest3/src3.dat') # => true ;T; 0o; ; [I"Keyword arguments:;T@o:RDoc::Markup::List: @type:BULLET:@items[o:RDoc::Markup::ListItem:@label0; [o; ; [I"D<tt>group: <i>group</i></tt> - changes the group if not +nil+, ;TI"-using {File.chown}[rdoc-ref:File.chown].;To;;0; [o; ; [I"B<tt>mode: <i>permissions</i></tt> - changes the permissions. ;TI"-using {File.chmod}[rdoc-ref:File.chmod].;To;;0; [o; ; [I"@<tt>noop: true</tt> - does not copy entries; returns +nil+.;To;;0; [o; ; [I"D<tt>owner: <i>owner</i></tt> - changes the owner if not +nil+, ;TI"-using {File.chown}[rdoc-ref:File.chown].;To;;0; [o; ; [I"3<tt>preserve: true</tt> - preserve timestamps ;TI"-using {File.utime}[rdoc-ref:File.utime].;To;;0; [o; ; [I";<tt>verbose: true</tt> - prints an equivalent command:;T@o;; [I"KFileUtils.install('src0.txt', 'dest0.txt', noop: true, verbose: true) ;TI"KFileUtils.install('src1.txt', 'dest1.txt', noop: true, verbose: true) ;TI"GFileUtils.install('src2.txt', 'dest2', noop: true, verbose: true) ;T; 0o; ; [I"Output:;T@o;; [I"#install -c src0.txt dest0.txt ;TI"#install -c src1.txt dest1.txt ;TI"install -c src2.txt dest2 ;T; 0o; ; [I"@Related: {methods for copying}[rdoc-ref:FileUtils@Copying].;T: @fileI"lib/fileutils.rb;T:0@omit_headings_from_table_of_contents_below000[ I"[(src, dest, mode: nil, owner: nil, group: nil, preserve: nil, noop: nil, verbose: nil);T@tFI"FileUtils;TcRDoc::NormalModule00