ftnk.jp -> ~fumi -> ChangeLog -> 2004-01 -> 2004-01-30

前の日 / 次の日 / 最新 / 2004-01

2004-01 / 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

2004-01-30 Fri

[別の年の同じ日: 2006 2007 2008 2009 2010 2011

相対パスを求める [Ruby] はてぶ

pathname を使って次のように.

require 'pathname'

path = Pathname.new("/home/fumi/test.txt")
from = Pathname.new("/home/fumi/test/1")

relative_path = path.relative_path_from(from)


=> #<Pathname:../../test.txt>