Is there a os.walk kind of function?

139 views
Skip to first unread message

avi.b...@nutanix.com

unread,
Sep 9, 2015, 10:56:23 PM9/9/15
to libnfs-python
I am trying to copy a directory(recursively) from an NFS mount to the local filesystem. What would be the best way to do so? Will I need to implement something like os.walk to be able to walk through the structure and create each directory and copy each file?

David Beaver

unread,
Sep 10, 2015, 5:23:10 PM9/10/15
to libnfs-python
Yes, you'll need to implement something like os.walk. The python library is all about access to the nfs rpc-level calls, so there's no os.walk-style methods built in. But really, unless you have some compelling need for access to the RPC level calls, you're probably better off just mounting the NFS export locally and using the conventional file copy capabilities to do the work. This library isn't designed as a replacement for all of the standard library routines, it's designed for people who want to avoid doing a standard mount call and don't need full posixAPI access to their files.

avi.b...@nutanix.com

unread,
Sep 10, 2015, 8:03:40 PM9/10/15
to libnfs-python
Thank you. I need to do RPC level calls. The standard library routines are disabled in the environment I am working in. Managed a basic os.walk kinda function. Thanks for the suggestions.

David Beaver

unread,
Sep 11, 2015, 4:03:51 PM9/11/15
to libnfs-python
Similar to what I had to do. I wound up not using the python bindings [for several reasons] and dropping back to C.
Reply all
Reply to author
Forward
0 new messages