Getting the same filename when renaming with wget [closed]

孤者浪人 提交于 2020-07-23 06:31:40

问题


Using Windows 10 and wget to download files from a specific location, installed and configured WSL2. Once the setup was done, opened and ran the following command

sudo apt-get install wget

Then, ran the following command

wget --header='Accept-Language: en-US,en;q=0.9,pt-PT;q=0.8,pt;q=0.7,de;q=0.6,fr;q=0.5,es;q=0.4,it;q=0.3,gl;q=0.2,hu;q=0.1' --user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36" -c "http://www.centrodeinformacao.ren.pt/_layouts/CI.GetExcel/SafeGetExcel.aspx?T=CRG&P="{1..3}"-"{1..12}"-"{2019,2020}"&variation=PT" -w 1

This saves the files in \\wsl$\Ubuntu-18.04\home\molecoder with the name SafeGetExcel.aspx?T=CRG&P=1-1-2020&variation=PT. If I want them as .xls, currently will need to go one by one and change the end of the file to .xls or automatically rename the file to what I want.

If I use

wget --header='Accept-Language: en-US,en;q=0.9,pt-PT;q=0.8,pt;q=0.7,de;q=0.6,fr;q=0.5,es;q=0.4,it;q=0.3,gl;q=0.2,hu;q=0.1' --user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36" -c "http://www.centrodeinformacao.ren.pt/_layouts/CI.GetExcel/SafeGetExcel.aspx?T=CRG&P="{1..3}"-"{1..12}"-"{2019,2020}"&variation=PT" -O {1..3}_{1..12}_{2019,2020}.xls -w 1

Then I'll get all the files with the name 1_1_2019.xls. How can I get that number to actually increase respectively (1_1_2019.xls, 1_1_2020.xls, 1_2_2019.xls, ...)?

来源:https://stackoverflow.com/questions/62871637/getting-the-same-filename-when-renaming-with-wget

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!