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

learn more… | top users | synonyms

1
vote
2answers
229 views

Questions about using scp

In a previous post, I asked a question about simply right-click copy and paste in Nautilus sometimes cannot handle files with special characters in their names under Ubuntu. Later I found that scp ...
7
votes
5answers
9k views

How can I copy a (big) directory over another changing only the files that differ?

I have directory a and directory b. They are big. b is almost identical to a. "almost" means that 4-5 files differ, and I don't know which they are. I want to copy b over a, but only the files that ...
2
votes
3answers
323 views

Copied directory appears to become larger at destination

I have the following code as part of a shell script: while [ $(ps -ef | awk '{print $2}' | grep -F "$CPPID") ]; do sleep 10 awk -v "usbsize=$(/bin/df | grep -F $DEVICEMOUNTPOINTQ | awk ...
0
votes
2answers
912 views

rtorrent copy after download

so I`m trying to do the following: When rtorrent finishes download, it should copy files from download dir to another dir called uploads, so the file would be in Downloads dir AND in Uploads dir. ...
10
votes
3answers
2k views

How is install -c different from cp

What is the difference between install -c and cp? Most installations tend to use install -c, but from the man page it doesn't sound like it does anything different than cp (except maybe set ...
0
votes
1answer
531 views

cp linux command options

how i do i copy all files from dir to another dir and escape file already exist and not overwrite it , using cp command under linux centos
1
vote
1answer
51 views

Query on “cp” command

I have a directory say ~/MyWorks which contains the following files in it: a.c, b.c and c.c I want to copy the MyWorks directory to ~/MyAssignments such that only the directory MyWorks is copied and ...
14
votes
4answers
11k views

How to copy symlinks to target as normal folders

i have a folder with symlinks: marek@marek$ ls -al /usr/share/solr/ razem 36 drwxr-xr-x 5 root root 4096 2010-11-30 08:25 . drwxr-xr-x 358 root root 12288 2010-11-26 12:25 .. drwxr-xr-x 3 root ...
1
vote
2answers
2k views

Find files in subdirectories and copy them to another directory with the same subdirectories?

This question is very similar to this one except that I want to maintain the file's original subdirectories. For example if I had /temp/a/a.txt /temp/a/a.jpg /temp/a/b.txt /temp/b/c.txt ...
1
vote
2answers
223 views

argument to cp in backticks doesn't work?

I tried using a command like cp `ls ~/temp/*.xyz | head -1` ./ But that does not work. If I echo the value of command inside back ticks and put it manually in cp command it works. Any ideas?
13
votes
3answers
26k views

Copy list of files

I have a list of files separated by spaces in a file list.txt. I'd like to copy them to a new folder. I tried to do: cp `cat list.txt` new_folder but it did not work. How would you do this ? ...
6
votes
4answers
3k views

Linux copy to fat32 filesystem: invalid argument

When I copy files from an ext3 partition to a fat32 one using cp: cp -R /ext3/stuff /fat32/partition/ I get invalid argument messages for all files with colons and question marks in. Is there any ...
7
votes
3answers
8k views

Copy file in GNU/Linux with progress bar and rate limiting

Is there any good tool in GNU/Linux that copy files like cp, but also shows progress and limits speed (and changes limit without interruption) like pv? Prototype: find source_directory | cpio -H ...
0
votes
1answer
115 views

Moving only the contents of a map and not the map itself on linux

Using the cp command, one can move files and folders on linux. I want to make a new user and move the contents of the skeleton map to their home directory. I use this command: cp -r /etc/skel/ ...
6
votes
5answers
5k views

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 ...
59
votes
7answers
94k views

How to copy symbolic links?

I have directory that contains some symbolic links: user@host:include$ find .. -type l -ls 4737414 0 lrwxrwxrwx 1 user group 13 Dec 9 13:47 ../k0607-lsi6/camac -> ../../include 4737415 ...
2
votes
4answers
1k views

cp command force

currently there's a xxx dir already in /home/yyy I'm trying to overwrite it cp -fr ../xxx /home/yyy/ doesn't work still prompts me to overwrite the individual files. how do I fix it?
3
votes
3answers
6k views

How do I use find to copy all found files to a new name in their same directories?

I've got a simple command that does almost what I want. The following will locate all files with a suffix of '_compressed.swf' and copy each into its same directory with a '.bak2' appended: find ...
2
votes
3answers
16k views

cp: reading `filename': Input/output error WHY?

I wish to know what could be the possible cases for this error: cp: reading `filename': Input/output error I am getting this message when I am trying to copy a big file of around 50MB.
5
votes
2answers
9k views

Use rsync to copy all files except for certain filenames with a certain extension

I have two same-size flash cards, and I want to copy contents of one to the other based on the following rules: I want all directories and subdirectories in place I want to exclude files of type ...
9
votes
5answers
44k views

Copying files with SSH

I am trying to copy a file from my other computer, to another computer. (both running Ubuntu 9.10) So say: I've ssh'ed into the other computer; i 'cd' to the directory; and i entered cp File.zip ...
1
vote
1answer
1k views

Copy directory from ext3 to FAT32 ignoring symlinks, pipes, etc

I'm trying to write a shell script in which I recursively copy a directory to a USB stick. I need the return value of the copy operation for error-checking purposes. I've tried cp -a /var/mydir ...
85
votes
6answers
65k views

How to copy with cp to include hidden files and hidden directories and their contents?

How can I make cp -r copy absolutely all of the files and directories in a directory Requirements: Include hidden files and hidden directories. Be one single command with an flag to include the ...
3
votes
7answers
918 views

How do I make “cp” in OS X not delete files?

Here's the best way to describe this: dirA dir1 file1.txt file3.txt dirB dir1 file1.txt file2.txt I want to copy the contents of dirB into dirA. cp -R dirB/* dirA ...
5
votes
5answers
5k views

cp -r -l in MacOS (recursive copy preserving hard links)

I'm trying to copy a directory tree recursively preserving hardlinks to the file. Using gnu cp, this would work with the -l flag. cp would then recreate the directory structure, but wouldn't need to ...