Thursday, May 10, 2012

Use wget to recursively get contents of a directory

Sometimes, it's just necessary to explore the directory space on a remote dir to know what are the specific keys that can be queried individually.
This is particularly convenient in the case of cloud instance metadata where one would like to find out what are all the metadata keys that are available for a given instance on a given cloud.

So, to download the complete directory tree recursively, use the following command (this example uses the 'default' cloud instance metadata server):

$ wget -rk Is http://169.254.169.254/latest/meta-data/

No comments: