Re: how to determine whether pathname1 is below bathname2

2010-07-11 Thread Dan Stromberg
You could probably: cd to dir1 getcwd cd to dir2 getcwd repeat cd .. getcwd if getcwd == dir1's cwd, then under until at / cd to dir1 repeat cd .. getcwd if getcwd == dir2's cwd, then under until at / This should deal with symlinks and junctions, as long as you aren't worried

Re: how to determine whether pathname1 is below bathname2

2010-07-11 Thread Gelonida
Hi Thomas, Thomas Jollans wrote: > On 07/11/2010 03:37 PM, Gelonida wrote: >> # >> import os >> def is_below_dir(fname,topdir): >> relpath = os.path.relpath(fname,topdir) >> return not relpath.startswith('..'+os.sep) >> >> print is_below_dir(

Re: how to determine whether pathname1 is below bathname2

2010-07-11 Thread Thomas Jollans
On 07/11/2010 03:37 PM, Gelonida wrote: > # > import os > def is_below_dir(fname,topdir): > relpath = os.path.relpath(fname,topdir) > return not relpath.startswith('..'+os.sep) > > print is_below_dir(path1,path2) > ###