vmware / pyvmomi-community-samples

A place for community contributed samples for the pyVmomi library.
Apache License 2.0
1.01k stars 922 forks source link

How to list all file in specific folder in datastore and download it? #722

Open SarindraTherese opened 1 year ago

SarindraTherese commented 1 year ago

Describe the bug

I want to recover the screenshots of a specified vm then delete them or group them in another directory in the vcenter browser via pyvmomi.

Reproduction steps

the step i've tried: Step 1- Download from Datastore https://github.com/vmware/pyvmomi/issues/814 this not work for me the error:

  File "C:\Users\Desktop\myproj\venv\Lib\site-packages\requests\adapters.py", line 523, in send
    for i in request.body:
  io.UnsupportedOperation: read

Step 2- How to list all folder in every datastore https://github.com/vmware/pyvmomi-community-samples/issues/343 This work, but now i want access the folder But I don't have any tips to do this

Expected behavior

This is my list of folder in datastore

I want to download all image in [VM]/VM-Screenshot like VM-Screenshot-1.png, VM-Screenshot-2.png, ... After create a new folder [VM]/VM-Screenshot entitled Downloaded where I will then move the images that I have already uploaded.

Additional context

No response