[Resolved] Linux Error 'Cp: Omitting Directory' Copy Command

Forums » Linux Systems » [Resolved] Linux Error 'Cp: Omitting Directory' Copy Command
this is an error you might get on your linux machine when you try to copy files or directories using the cp command. This article will explain why you are getting this error and how to fix it so you can copy your files without any errors
ok, i've done this so many times, and i just forgot how to overcome this error.

so i am writing this little how to just incase you are also having this problem.

if you are getting this error: cp: omitting directory

this is what you need to do:

cp -r orginal_file new_file


so the trick here is to add the -r escape on your command and it shouldn't give you an error anymore

the -r options if for recursive, meaning copy all the files within a directory. the mostly likely reason you are getting this error is because you are trying to copy a directory which has other files or other sub-directories, so you need to tell linux to copy all the files withing (recursive).

hope this helps.

if you ever need web hosting, visit www.webune.com they have excellent service.
Wesley
THANKS....it work,,,,,,,,,,,,,,,,,,,,,
Biljana
Thank you so much. It works for me. :) Thank you.
david
Thanks for the post, it worked great, and it says my message is short, so I'm making it bigger.
Stuart
thanks mate, just what I needed! thanks mate, just what I needed!
http://wallpaperama.com/forums/cp-omitting-directory-linux-command-error-t1580.html
Gebreab
Thank you I just read it for a while and apply perfectly done!!
OuS
Thank you very much!! Thank you very much!!
totem
thank you :)
ankur
thank you sir awesome..
Ravindra
cp -R /file_name /mnt/Centos
gilad
THANK YOU!!! I'm sending you all my love!
swarnim
thank you.........
Thije
thanks a lot!
rytho7533
This does not work for me. I then get errors "cp: reading" ...: "Input/output error" for each file I am trying to copy.
picillo
Thank you.
Deepak
Thanks a lot!!
NIRAV
grt sir, it seriously helped me out
arun
thanks a lot man
Esp
Thanks man
sharvari
Works .. But how??
kranthi
good,this is one way of distributing knowledge, very use full in trouble shotting
Aaron
I believe -r stands for recursive. I think you get this error when you try and copy a directory and its contents and not a file, so it needs the recursive command.
JimP
Thanks for immediate help on the Internet. This solved my problem. I'm bumbling and stumbling and learning as I go.
dtop
Thank you.
khaled
thanks :)) baraka allah fik
mahrizal
thank's it works for me
Petka
Very nice article.
petka
tag
helped a lot man. thanx
Amol
Thanks for your help!!
M
thanks dude
Manus
Thanks a lott ... it worked
Yadda
The given solution fixes the problem but unfortunately the article doesn't explain *why* it does... So in the long run it's rather useless.
rob
whenever you want to know something about a command, visit the man pages, for example: man cp

in the instructions, you will see why the -r

but ill tell you, it means recrusive, meaning including all the files/directories (sub-directories) within the copied directory
YOU_LAZY
it worked for me. if you want to know why..

READ A BOOK!!!
Roshan
wow man ....but how its works tell me .
Sridhar
Thanks sir...it really helped me :)
Sai
Thanks a lot
prohor
I want to know how it works and why the error occur...
Dude
Doesn't work. It copies some other files too. This is NOT the solution, so be careful.
chandrashekar
It's working ,Thanks buddy
shbk
man cp -R, -r, --recursive copy directories recursively i understand it so: you can't copy directory without files which lie inside , and cp looks which files are inside only with -R option
Captnbob
Thank you. Thank you. Once again thanks.
Cesar
there's always someone annoying. It works, that's all.
MyNameIs1337
yep works!
Ivanof
Great!! Thanks! :D
James
Thanks. It worked like MAGIC!
Cherodney
It works just fine. Love it
Housefly
It works becuase it fails if you do not specify any specific or wildcard files. -r makes it recursive - meaning it will include subfiles/folder Does it make sense?
nawraj
thank you............
Daniel
Thank you a lot :D I don't use this command as often and had completely forgot that you need to use -r for domains.
banzai
This is rather useless, since its a partial solution (not an answer). In the wonder land this is usually caused by trying to copy to multiple targets such as when shell expansion is used or output from other commands
Anne
Thank you -- exactly what I needed to copy a directory of files from disk to a network appliance.
Joker
thanks man
very good post
indra
thank you gan, it works !!!
francis
does anyone know if this works on redhat distributions like fedora or centos. i have ubuntu and i dontk now what to do.
serg
Thank you work perfect for me
Title: [Resolved] Linux Error 'Cp: Omitting Directory' Copy Command [2920]
Tags: cp omitting directory linux command error
By
Comments 54
Visits 75702