问题
I am trying to use cURL for the first time to download some data. I am working with the cmd prompt in Windows 7. I have a txt file with lots of URLs where the files I want to download shoul be. In the website I am using to retrieve the data I want, the help says to use this function to download the dataset:
for i in `cat <url text file>`; do curl $i -OL -s; done
but after some tries I culdn't come up with a solution so far. What am I supposed to insert instead of that ""? I thought simply to point to the directory where the txt file is stored and specify its name and extension, like this:
C:\Users\Umberto>for i in `cat C:\Users\Umberto\Downloads\data_url_script_2013-03-01_062649.txt`; do curl $i -OL -s; done
I receive the message
i non atteso
(which means "i not expected") Do You have any clue how to solve this? Many thanks in advance.
One up to date note: I succeded in downloading the file in the current directory, but only specifying one URL instead of the list I had. What I am interested to do now is download all the data I have (specified in a list of URLs within the text file) by one single command (as the one specified above).
回答1:
It looks like you are attempting to run some sort of Unix style shell command in the windows 7 command prompt.
You should be able to achieve the same result if you run a similar command in a Windows Powershell command prompt. If you unzip the curl tool to the following folder: C:\Users\Umberto\Curl the following should work if you run it in a Windows Powershell command prompt.
Get-Content C:\Users\Umberto\Downloads\data_url_script_2013-03-01_062649.txt | %{C:\Users\Umberto\Curl\curl.exe $_ -OL -s}
来源:https://stackoverflow.com/questions/15156983/curl-http-transfer-data