Link a file : symlink « File Directory « Ruby






Link a file


new_filename = "#{filename}2"
File.symlink(filename, new_filename)

File.symlink? new_filename                  # => true
File.file? new_filename                     # => true

 








Related examples in the same category

1.symlink? Returns true if the file is a symbolic link