Method: FileUtils.link_entry
- Defined in:
- lib/fileutils.rb
permalink .link_entry(src, dest, dereference_root = false, remove_destination = false) ⇒ Object
Hard links a file system entry src
to dest
. If src
is a directory, this method links its contents recursively.
Both of src
and dest
must be a path name. src
must exist, dest
must not exist.
If dereference_root
is true, this method dereferences the tree root.
If remove_destination
is true, this method removes each destination file before copy.
409 410 411 412 413 414 415 |
# File 'lib/fileutils.rb', line 409 def link_entry(src, dest, dereference_root = false, remove_destination = false) Entry_.new(src, nil, dereference_root).traverse do |ent| destent = Entry_.new(dest, ent.rel, false) File.unlink destent.path if remove_destination && File.file?(destent.path) ent.link destent.path end end |