Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

Is there a better way on the command line to essentially accomplish the following but with a single command

cp -r css/ ar/
cp -r images/ ar/
cp -r js/ ar/
cp -r backups/ ar/

I've just been stringing them together with a semicolon.

share|improve this question

migrated from serverfault.com Mar 19 '13 at 15:18

This question came from our site for system and network administrators.

up vote 25 down vote accepted

Copying folders into another folder (folder in folder):

cp -r css images js backups ar/

Note: this is different from copying just the contents themselves(contents of folders in folder):

cp -r css/ images/ js/ backups/ ar/
share|improve this answer

You can't copy two directories using cp command alone.

You can copy recursively using -r option though.

For example:

cp -r <source> <destination> 
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.