M
Michael Schuerig
Is there an "official" way of recursively copying directories so that
individual files are hard-linked (if possible)? FileUtils has methods
for creating single hard links (#ln) as well as for recursive copying
(#cp_r). What's missing is the combination, essentially a call to
cp -al src dest
However, I'm wary of using this instead of FileUtils.cp_r(src, dest) as
the semantics are different. #cp_r makes a copy with path dest of a
directory with path src. In contrast, cp -a src dest copies src into(!)
dest. Now, File.dirname(File.expand_path(dest)) gives me the parent
directory, but I'm simply not sure whether it works as intended in all
cases.
Any suggestions?
Michael
individual files are hard-linked (if possible)? FileUtils has methods
for creating single hard links (#ln) as well as for recursive copying
(#cp_r). What's missing is the combination, essentially a call to
cp -al src dest
However, I'm wary of using this instead of FileUtils.cp_r(src, dest) as
the semantics are different. #cp_r makes a copy with path dest of a
directory with path src. In contrast, cp -a src dest copies src into(!)
dest. Now, File.dirname(File.expand_path(dest)) gives me the parent
directory, but I'm simply not sure whether it works as intended in all
cases.
Any suggestions?
Michael