[tpm] How determine the real directory path

Antonio Sun antoniosun at lavabit.com
Sun Apr 29 07:29:58 PDT 2012


Instead of retrieving and comparing the inodes yourself, try this:

use Cwd;
Cwd::realpath /a/b/c

and check if it is the same as Cwd::realpath /x/y/z

HTH

Antonio

On Sat, Apr 28, 2012 at 10:46 AM, Indy Singh <indy at indigostar.com> wrote:

>   Thanks, that worked.
>
> Indy Singh
> IndigoSTAR Software -- www.indigostar.com
>
>  *From:* Fulko Hew <fulko.hew at gmail.com>
> *Sent:* Saturday, April 28, 2012 8:59 AM
> *To:* Indy Singh <indy at indigostar.com>
> *Cc:* toronto-pm at pm.org
> *Subject:* Re: [tpm] How determine the real directory path
>
>
>
> On Sat, Apr 28, 2012 at 7:29 AM, Indy Singh <indy at indigostar.com> wrote:
>
>>   Hello all,
>>
>> I want to copy files from one directory to another where the directory
>> paths are something like:
>> /a/b/c to /x/y/z
>>
>> I need to detect if the two directory paths are identical after symbolic
>> links are resolved, in order to skip the file copy.
>>
>> Using File::Copy::copy sets $! to ‘No such file or directory’
>>
>>  Using cp from a shell prompt gives an error like:
>> cp: `/a/b/c/foo.txt' and `/x/y/z/foo.txt' are the same file
>>  Anyone have an idea how to resolve this?
>>
>
> Can you use stat() to get the inodes of both directories to see if they
> are the same?
>
>
>
> _______________________________________________
> toronto-pm mailing list
> toronto-pm at pm.org
> http://mail.pm.org/mailman/listinfo/toronto-pm
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/toronto-pm/attachments/20120429/013bf600/attachment.html>


More information about the toronto-pm mailing list