Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

i am not able to copy file in /var/www with sudo cp /home/index.html /var/www

the error is

cp:omitting directory '/home/index.html'

then i used -r, sudo cp -r /home/index.html /var/www, then the error is

cp: cannot overwrite non-directory '/var/www/index.html' with directory '/home/index.html'
share|improve this question
2  
Is /home/index.html a file or folder? I'm not sure, but your error message make it looks like it is a folder, but it should be a regular file. –  iBelieve Jan 22 '13 at 18:24

1 Answer 1

Judging by the error message, /home/index.html is a directory (folder), not a file, and /var/www/index.html already exists and it is a regular file.

To see if /home/index.html is a directory, try:

file /home/index.html

It will probably say: /home/index.html: directory.

If that's the case, you cannot copy a directory over file. Maybe the file you're trying to copy is inside the directory /home/index.html? Then the command would be something like

sudo cp -r /home/index.html/index.html /var/www
share|improve this answer

Your Answer

 
discard

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.