Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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 just want to copy the contents of a directory and the subdirectories within it over to another directory in a Bash shell. I assumed cp -r would do this.

However, this isn't working:

cp -r $BASEDIR/Upload/Temp $BASEDIR/backup

The directory Temp has a bunch of files and directories in it. But after I run this command, I only get the files in backup. No directories are copied.

I'm also having the same problem with the -r option with a zip command. In the same Bash shell, I've got these commands:

cd $BASEDIR/Upload/Temp
zip -r $BASEDIR/Backup2/ .

When I look at the contents of, all it has are the files, no subdirs. (I cd into the directory because it's the only way I know to store files in a zip without getting the absolute path stored as well, which I don't need.)

What am I not getting about the -r option?

share|improve this question
up vote 3 down vote accepted


  • cp -R maybe that will work, or
  • cp -rf, you can also try
  • cp -av origin_folder destiny_folder –
  • But cp -r /home/hope/files/* /home/hope/backup, should have worked.
share|improve this answer
cp -R worked. Strange that case made a difference, but... weirdness sometimes happens. – Questioner Mar 24 '12 at 12:31
the -r and -R are equivalent in the Ubuntu cp (coming from GNU coreutils), so probably you were making some other mistake. – enzotib Mar 24 '12 at 17:05

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.