Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to copy a list of files into a single directory, but make the target directory the first filename in the command, how can I do it with linux command.

share|improve this question
The cp command will do what you want but the target directory must come after the souce file(s). Why do you want to change from the accepted standard? Try man cp for more info. – Mike Fitzpatrick Sep 29 '11 at 4:55

Do you mean you the command to look like the following -

specialcopy destDir filetocopy1 filetocopy2 filetocopy3

if so, create a script called with below text


cp "$@" "$DEST"
share|improve this answer

On Linux, there is cp -t for xargs users.

xargs -d'\n' cp -t targetdir < filelist
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .