Skip to content

Instantly share code, notes, and snippets.

@shugo
Created December 8, 2017 08:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shugo/c074da8dedf79ea3b56d860751c0e64c to your computer and use it in GitHub Desktop.
Save shugo/c074da8dedf79ea3b56d860751c0e64c to your computer and use it in GitHub Desktop.
regular_file = "./regular"
symlinkfile = "./symlink"
File.delete(regular_file) rescue nil
File.delete(symlinkfile) rescue nil
File.open(regular_file, "w") {}
File.symlink(regular_file, symlinkfile)
p File.lstat(symlinkfile).atime
t = Time.local(2000)
stat = File.lstat(symlinkfile)
sleep 1
File.utime(t, t, symlinkfile)
p File.stat(regular_file).atime
p File.lstat(symlinkfile).atime
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment