D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
FileUtils
/
Filename :
touch-c.ri
back
Copy
U:RDoc::AnyMethod[iI" touch:ETI"FileUtils::touch;TT:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [ I"AUpdates modification times (mtime) and access times (atime) ;TI"1of the entries given by the paths in +list+ ;TI"+(a single path or an array of paths); ;TI"Areturns +list+ if it is an array, <tt>[list]</tt> otherwise.;To:RDoc::Markup::BlankLine o; ; [I"MBy default, creates an empty file for any path to a non-existent entry; ;TI"Cuse keyword argument +nocreate+ to raise an exception instead.;T@o; ; [I"%Argument +list+ or its elements ;TI"Kshould be {interpretable as paths}[rdoc-ref:FileUtils@Path+Arguments].;T@o; ; [I"Examples:;T@o:RDoc::Markup::Verbatim; [I"# Single path. ;TI"/f = File.new('src0.txt') # Existing file. ;TI"3f.atime # => 2022-06-10 11:11:21.200277 -0700 ;TI"3f.mtime # => 2022-06-10 11:11:21.200277 -0700 ;TI"!FileUtils.touch('src0.txt') ;TI"f = File.new('src0.txt') ;TI"4f.atime # => 2022-06-11 08:28:09.8185343 -0700 ;TI"4f.mtime # => 2022-06-11 08:28:09.8185343 -0700 ;TI" ;TI"# Array of paths. ;TI"/FileUtils.touch(['src0.txt', 'src0.dat']) ;T:@format0o; ; [I"Keyword arguments:;T@o:RDoc::Markup::List: @type:BULLET:@items[ o:RDoc::Markup::ListItem:@label0; [o; ; [I"M<tt>mtime: <i>time</i></tt> - sets the entry's mtime to the given time, ;TI"!instead of the current time.;To;;0; [o; ; [I"O<tt>nocreate: true</tt> - raises an exception if the entry does not exist.;To;;0; [o; ; [I"A<tt>noop: true</tt> - does not touch entries; returns +nil+.;To;;0; [o; ; [I";<tt>verbose: true</tt> - prints an equivalent command:;T@o;; [I"<FileUtils.touch('src0.txt', noop: true, verbose: true) ;TI"JFileUtils.touch(['src0.txt', 'src0.dat'], noop: true, verbose: true) ;TI"6FileUtils.touch(path, noop: true, verbose: true) ;T; 0o; ; [I"Output:;T@o;; [I"touch src0.txt ;TI"touch src0.txt src0.dat ;TI"touch src0.txt ;T; 0o; ; [I""Related: FileUtils.uptodate?.;T: @fileI"lib/fileutils.rb;T:0@omit_headings_from_table_of_contents_below000[ I"?(list, noop: nil, verbose: nil, mtime: nil, nocreate: nil);T@TFI"FileUtils;TcRDoc::NormalModule00