spamman
spamman

Reputation: 11

Is it possible to run wget using both -O and -P options together?

I want to download a program. For example "package.zip"

I want to download it in, for example "~/programs/downloaded"

I want to name it, for example "new.zip"

So I tried:

wget -P ~/programs/downloaded \
     -O new.zip   https://somewebsite.com/package.zip

But it only downloaded the package in the terminal's current directory and renamed it. The -P command does not work. Any idea how to make it work?

Upvotes: 1

Views: 538

Answers (1)

darnir
darnir

Reputation: 5190

This is a feature of wget that has bitten many people. Unfortunately, it was a design decision taken many years ago and cannot be changed now for fear of breaking existing scripts. The crucial thing to understand here is that -O acts like shell redirection and hence is unaffected by the -P option.

The way to do what you want would be to directly provide the filename:

wget -O ~/programs/downloaded/new.zip <url>

Upvotes: 3

Related Questions