Skip to content

End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

FileUtils#touch

touch(list, noop: nil, verbose: nil, mtime: nil, nocreate: nil)

Updates modification time (mtime) and access time (atime) of file(s) in list. Files are created if they don’t exist.

Example
FileUtils.touch 'timestamp'
FileUtils.touch Dir.glob('*.c');  system 'make'
See also .touch #symlink #uptodate? #safe_unlink also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1