Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

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 Mar 19 '13 at 15:18

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

2 Answers 2

up vote 18 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.