Re: Comparison function for directories?



*** Rik Wasmus escribió/wrote (Thu, 28 Feb 2008 19:00:09 +0100):
$dir1 = "/usr/local/apache2/htdocs/"
$dir2 = "/usr/local/apache2/htdocs"

$is_the_same_dir = realpath($dir1) == realpath($dir2);

Just two remarks:

- In Unix, the file system is case sensible. So (depending on what you need
this for) you may use === instead.

- realpath() returns FALSE when the path does not exist; take it into
account.


--
-+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
++ Mi sitio sobre programación web: http://bits.demogracia.com
+- Mi web de humor austrohúngaro: http://www.demogracia.com
--
.



Relevant Pages

  • Re: Comparison function for directories?
    ... In Unix, the file system is case sensible. ... depending on exactly what the OP is hoping ... to compare -- the directory paths of real, existing directories, or ...
    (comp.lang.php)
  • Re: Comm Ports 10+
    ... He'd copied over a massive system from Unix to Windows, ... File System, AFS, developed at CMU at its Information Technology Center. ... All devices are in the internal kernel namespace '??' ...
    (microsoft.public.vc.mfc)
  • Re: A Symbol- Abstracted Al
    ... depending at last. ... The unix of the compatible lounge is the ... breakfast that guarantees technically. ...
    (sci.crypt)
  • Re: trouble with rename-file
    ... Which by looking at the source of the function rename-file is an error ... foreign function call to the unix function rename. ... Not all partitions contain a file system. ... That's what the dfcommand shows you. ...
    (comp.lang.lisp)
  • Re: linux usb drive
    ... Just a little, again, what file system is in use on the drive? ... Unix user 501. ... then you just need to take ownership of the drive. ... Right-click the folder that you want to take ownership of, ...
    (microsoft.public.windows.vista.security)