Questions tagged [cp]

cp is the command of the Unix operating system that is used to copy files.

218 questions
92
votes
9 answers

Copy files in Linux, avoid the copy if files do exist in destination

I need to copy a /home/user folder from one hard disk to another one. It has 100,000 files and around 10G size. I use cp -r /origin /destination sometimes I get some errors due to broken links, permissions and so on. So I fix the error, and need…
Open the way
  • 8,613
16
votes
8 answers

How can I use cp to copy a directory but ignore a certain sub directory in Linux

Due to a Hard disk problem I am trying to shift a partition from one hard disk to another. I am following http://www.ibm.com/developerworks/library/l-partplan.html article to do that. In the copying part I would like to ignore one particular sub…
P Roy
  • 163
10
votes
1 answer

cp --backup=CTRL, why nil and never?

https://linux.die.net/man/1/cp The backup suffix is '~', unless set with --suffix or SIMPLE_BACKUP_SUFFIX. The version control method may be selected via the --backup option or through the VERSION_CONTROL environment variable. Here are the…
midnite
  • 571
5
votes
2 answers

Why OSX cp -avr get this error: the -R and -r options may not be specified together?

I just want to copy a folder tree to another place like this: cp -avr /blah/blah/htdocs ./ but I got error: cp: the -R and -r options may not be specified together. I followed this tutorial:…
Rob Lao
  • 1,031
3
votes
4 answers

cp verbose alternative

I want to list all of the files that are being copied by a cp command but the -v switch doesn't seem to exist on the servers here at work. I'm not sure exactly which OS this is. I think it might be SunOS. How could I find out if that is…
A Jackson
  • 1,027
3
votes
4 answers

how to copy all files from one location to another in linux

I want to copy all the folders and files in the /var/www/ directory to another directory /media/magneto/ How do I do this? I tried this command cp -pRiv /var/www/ /media/magneto/ that didn't work because it basically created a directory called…
Jason
  • 1,899
  • 7
  • 31
  • 40
2
votes
2 answers

Linux cp command is not silent

I know with a -f cp should be silent but it's not! I do cp -rf Functional Functionalssssssss and if Functional does not exist, it says cannot stat 'Functional'... but I just don't want to see the error message!! I want to handle them myself
Cher
  • 191
0
votes
0 answers

cp didn't copy all files few files were missing

How is it possible that cp didn't copy all files from a huge directory? I did cp on a large directory with 5000 files. I checked contents with diff and it was not matching! How is this possible? I ran cp -rv devholidayge/ holiday/
user98645
0
votes
3 answers

cp command inquiry

If I am in a directory called /usr/share/tcl8.3/encoding, what command would copy all files begining "cp" that also contain an even number (from the following list): cp1250.enc cp1255.enc cp737.enc cp857.enc cp864.enc cp932.enc cp1251.enc …
user98496
  • 723
0
votes
0 answers

Use `cp src/* des/` suppressing warning when encountering folders

How can I use cp src/* des/ for copying all files which are not directories and without receiving the warning cp: is a directory (not copied).?
Nisba
  • 173
0
votes
1 answer

missing destination file operand when cp

i tried to use the Linux alias: rm='cp $* ~/dustbin; rm $*' but it reported 'missing destination file operand after ~/dustbin' , why didn't cp recognize ~/dustbin as destination ?