rainen
rainen

Reputation: 13

Is this Linux copy command redundant and invalid?

I want to update my Wordpress site using SSH and I read in a blog how to achieve it.

But before anything else, I want to confirm if this is a valid Linux copy command. Because I am not sure. I will explain why..

here's the syntax - cp -rpf -f /WordPress3.9.1/* /wordPress3.9.2/

according to the blog, this command will "Copy the updated files and overwriting the old files"

notice that there are TWO -f flags.. according to http://explainshell.com/ the -f flag tells the copy command that if an existing destination file cannot be opened, remove it and try again. I am not sure if having 2 -f flags in the cp command syntax is redundant and invalid. please help!

according to http://explainshell.com/

cp - copy files and directories

-R, -r, --recursive - copy directories recursively

-p - same as --preserve=mode,ownership,timestamps

-f, --force - if an existing destination file cannot be opened, remove it and try again (redundant if the -n option is used)

Upvotes: 0

Views: 852

Answers (1)

nneonneo
nneonneo

Reputation: 179717

-f is just a flag. Specifying it twice is just going to cause the flag to be set twice; there's nothing wrong with this, and it is functionally the same as only specifying it once.

Some options like -v increment a variable value, which would make two uses different from one use, but this is not the case for -f.

Upvotes: 6

Related Questions