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.
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)
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.
User contributions licensed under CC BY-SA 3.0