Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have been using the following command to pull back files from a web server and store them on my local machine:

$client = New-Object System.Net.WebClient

Is there a way of modifying this to pull back a whole directory? This is my first time using Powershell and the only other exposure I've had to anything like this is wget in Linux.

Any help would be greatly appreciated.

share|improve this question
Is this your website? Since I assume you have permission, use an FTP program... Otherwise you'll need to query the server to get the list of files, and then iterate through. Seems odd though to use Powershell – Dave Aug 27 '15 at 13:14

Use a tool that is appropriate for this, like WGet. This does not guarantee that you will download an entire directory, it will just give you all the pages linked to from your starting URL. Judging from the URLs in your question you do not know the remote directory anyway, so the term is meaningless - the site could be distributed over many directories.

If you do know the server and directory name, use an FTP program, e.g. FileZilla.

share|improve this answer

Another good utility (besides WGet) is HTTrack.

It can 'rip' a complete website. It even makes links work locally. You could try to do all that in Powershell but using an advanced tool like httrack, it does it all for you, especially the link translation.

Like Jan Doggen said, it depends what you are using it for. If you want a backup of your website you should use ftp. If you want a local rip you can check out httrack.

HTTrack homepage
HTTrack info page on wikipedia

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.