angelzzz
angelzzz

Reputation: 167

How to make correct wget request?

I need to copy xml file from server to my folder and name it as daily.xml. Here is my code.

The problem is that every new file has name daily.xml.1, daily.xml.2 etc

How to name new file as daily.xml, and previous file as previous-daily.xml? As I know I need to use -O but I don't understand how to use it

wget -P /home/name/name2/docs/xml/ http://www.domain.com/XML/daily.xml

How to make correct request?

Upvotes: 1

Views: 208

Answers (1)

Gyro Gearloose
Gyro Gearloose

Reputation: 1154

What about

wget -P /home/name/name2/docs/xml/  http://www.domain.com/XML/daily.xml -O daily$(date +'%Y%m%d%H%M%S').xml

Maybe the resolution by seconds is not fine enough and you need to have a count variable.

This dose not, however, rename your previous files.

In case your only original problem was the your system does not recognize *.xml.7 as xml-file, the command above should fix this.

Edit: as for your comment, you could do

mv daily.xml previous-daily.xml;wget -P /home/name/name2/docs/xml/  http://www.domain.com/XML/daily.xml -O daily.xml

Upvotes: 2

Related Questions