From: Michael Schuerig Date: 2010-08-22T04:24:55+09:00 Subject: Directory copying using hard links? 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 -- Michael Schuerig mailto:michael@schuerig.de http://www.schuerig.de/michael/