Chintan,

Use 'download' (http://libguestfs.org/guestfs.3.html#guestfs_download)

--
  Mykola Ivanets

пт, 28 черв. 2019, 18:55 користувач Chintan Patel <chintan.r.patel@outlook.com> пише:
Hi Nikolay,

We use guestfish, so I preferred to use commands supported by guestfish.
I tried as below but "realpath" is not working after I have the target path from symlink.
--> Check if the path has a symlink.
is-symlink path
Ex. - is-symlink "/etc/resolv.conf"   -> return true

--> If it's true then get target link path
readlink path
ex. - readlink "/etc/resolv.conf"  --> return "../run/systemd/resolve/stub-resolv.conf"

--> Which return's target path but it's not a full path, so needs to get full path to access the target file. 
Tried to use realpath as below using target path from above return but it's giving None

ex. - realpath "../run/systemd/resolve/stub-resolv.conf"  --> return None


Can you tell me how can I get the real path as without the full canonicalized absolute path I can't do anything with that file.


Thanks,
Chintan

From: libguestfs-bounces@redhat.com <libguestfs-bounces@redhat.com> on behalf of Nikolay Ivanets <stenavin@gmail.com>
Sent: Friday, June 28, 2019 2:00 AM
To: Chintan Patel
Cc: libguestfs@redhat.com
Subject: Re: [Libguestfs] Guestfish command - "copy-out" not working for symbolic links
 
If it is one time operation you can call 'realpath'
(http://libguestfs.org/guestfs.3.html#guestfs_realpath) first to
resolve symlink.

--
    +380979184774
    Mykola Ivanets

пт, 28 черв. 2019 о 11:11 Chintan Patel <Chintan.Patel@microsoft.com> пише:
>
> HI,
>
> I’m trying to use copu-out command to copy files from remote disk but it’s not working if the file is symbolic link.
>
> copy-out giving an error like below.
> libguestfs: error: ‘/etc/resolv.conf’ is not a file or directory
> This file is there but it's a symbolic link
>
> Do you have any other way to copy remote symbolic link files?
>
> Thanks,
>
> Chintan
>
> _______________________________________________
> Libguestfs mailing list
> Libguestfs@redhat.com
> https://www.redhat.com/mailman/listinfo/libguestfs

_______________________________________________
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs