Feature #4189

FileUtils#ln_r

Added by Thomas Sawyer over 3 years ago. Updated over 1 year ago.

[ruby-core:33820]
Status:Assigned
Priority:Normal
Assignee:Yukihiro Matsumoto
Category:lib
Target version:next minor

Description

=begin
I wrote a method for FileUtils to do recursive hard linking. It works just like cp_r but links instead of copies.

The code can be found along with the pull request I made to ruby/ruby on Github:

http://github.com/ruby/ruby/pull/4#issuecomment-631067

It's a pretty handy method for "staging" read-only files. For example I've used it to stage test fixture files in a tmp testing location and I've used it collect together a set of files for packaging into a tarball.
=end

fileutils_ln_r.patch Magnifier (4.72 KB) Zachary Scott, 11/19/2012 07:09 AM

History

#1 Updated by Yui NARUSE about 3 years ago

  • Status changed from Open to Assigned
  • Assignee set to Yukihiro Matsumoto

=begin

=end

#2 Updated by Yukihiro Matsumoto about 3 years ago

=begin
Since ln command does not have -r option, I am kind of hesitating to add lnr. I understand usefulness of the method. But I am not sure yet where to add (is fileutils the best place?), and what to add (is lnr the best name for the method?).

matz.
=end

#3 Updated by Sakuro OZAWA about 3 years ago

=begin
FYI
X11 distribution has lndir command, it creates real directories and file symlinks though.
=end

#4 Updated by Johan Holmberg almost 3 years ago

=begin
GNU cp has the -l option, so I think the proposed method is similiar to "cp -lr" on Linux systems.
=end

#5 Updated by Jamie Winsor almost 2 years ago

This ticket hasn't seen action in a year, but I wanted to chime in and +1 the feature.

Having a convenience function to recursively create hard links based on a source directory is a rare need, but a need, nonetheless. I think FileUtils is a fine place for it when compared to the other choices of where to place it in Ruby core.

#6 Updated by Zachary Scott over 1 year ago

Adding Thomas' patch from github.

#7 Updated by Yusuke Endoh over 1 year ago

  • Target version set to next minor

Also available in: Atom PDF