Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is it possible to download a file from the web using RoboCopy? What would the syntax for that be? Here's what I'm trying:

RoboCopy "http://www.google.com/" "C:\some_folder\" "index.html" /L /V /E /LOG:"C:\some_folder\test_robocopy.log" /R:10 /W:30

The error log is giving me an error that seems to indicate the file is a folder, and also that it's trying to hit http://www.google.com as a folder on my location machine.

-------------------------------------------------------------------------------
   ROBOCOPY     ::     Robust File Copy for Windows                              
-------------------------------------------------------------------------------

  Started : Tue Jan 08 10:31:04 2013

   Source : C:\some_folder\http:\www.google.com\index.html\
     Dest : C:\some_folder\index.html\

    Files : *.*

  Options : *.* /V /L /S /E /COPY:DAT /R:10 /W:30 

------------------------------------------------------------------------------

2013/01/08 10:31:04 ERROR 123 (0x0000007B) Accessing Source Directory C:\some_folder\http:\www.google.com\index.html\
The filename, directory name, or volume label syntax is incorrect.
share|improve this question
1  
robocopy doesn't speak HTTP. –  jscott Jan 8 '13 at 15:40

2 Answers 2

up vote 3 down vote accepted

The only way I can conceive of making this work is if you create a WebDAV share, such as the one at live.sysinternals.com, and then address it as a UNC (\\yoursite.com\folder) and the minidirector in the WebClient service will handle it.

But that requires a specific configuration on the web server.

Also, Invoke-WebRequest if you're using PS 3.

Edit: Also make sure the WebClient service is running before trying to access WebDAV shares on the command line. Windows Explorer will start the service on demand, but cmd.exe or powershell.exe will not.

share|improve this answer

No, this doesn't work. You'll need to use some other method for downloading the file from the internet before you try and robocopy it. Perhaps one of the ports of wget or similar would meet your needs or you can download a file natively in PowerShell 2.0 like this:

$webClient = New-Object System.Net.WebClient
$webURL = "http://www.google.com/index.html"
$filePath = "c:\whatever\index.html"
$webclient.DownloadFile($webURL,$filePath)
share|improve this answer

Your Answer

 
discard

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.