in reply to Re^2: Finding out whether two directories are the same (insert)
in thread Finding out whether two directories are the same

Or you could lock a file you find in $x and see if you hold the lock on that file in $y

Or, then, I could create a tempfile (File::Temp) in one, and see whether the tempfile exists in the other!!!

-- 
Ronald Fischer <ynnor@mm.st>
  • Comment on Re^3: Finding out whether two directories are the same (insert)

Replies are listed 'Best First'.
Re^4: Finding out whether two directories are the same (insert)
by oko1 (Deacon) on Aug 28, 2008 at 13:54 UTC

    rovf++ - this may well be the most portable idea of all. There is a very small chance of failure in weird setups like AFS, in which synchronization between the exported and the local dir may happen days apart, but that's a real stretch.

    
    -- 
    Human history becomes more and more a race between education and catastrophe. -- HG Wells
    
Re^4: Finding out whether two directories are the same (insert)
by linuxer (Curate) on Aug 28, 2008 at 15:09 UTC

    You should not forget to check, if the file creation was successful. If you don't have permission to create the file and you don't check that, your check for existence might lead to a wrong conclusion!

      You should not forget to check, if the file creation was successful.

      If I use File::Temp::tempfile, this throws an exception if it can't create the file, so checking must be done by wrapping it into an eval block and testing $@ afterwards.

      -- 
      Ronald Fischer <ynnor@mm.st>