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

learn more… | top users | synonyms

0
votes
1answer
24 views

Mac mv command very slow

On my mac cp command works 9 times faster then mv. Why it is possible? Mac-Pro-AVM-4:2014-10-22 editor$ time cp /Volumes/AVM4_HD5/INGEST/Final\ Cut\ Original\ Media/2014-10-22/Clip\ \#13.mov ...
3
votes
2answers
125 views

Recursive, Non-Overwriting File Copy?

I've got a directory that contains a bunch of other folders containing CoffeeScript/ JavaScript files. I'm able to compile the CoffeeScript files into a new folder with the same folder structure ...
0
votes
1answer
39 views

cp: cannot stat : No such file or directory

I am getting an error when I try to copy a file from my local computer to a remote server. I get the same error whether I use cp or scp. Here is my input at the resulting error: ...
1
vote
1answer
21 views

Copying files without losing metadata in Linux

How on Linux can I copy things like music files with “Artist” and “Title” tags without losing the tags? Will rsync work? Will cp? Does either one need any specific switch?
0
votes
0answers
27 views

Syntactic differences in cp -r and how to overcome them [migrated]

Let's say we are in a blank directory. Then, the following commands: mkdir dir1 cp -r dir1 dir2 Yield two (blank) directories, dir1 and dir2, where dir2 has been created as a copy of dir1. ...
3
votes
3answers
2k views

cp - do not overwrite in makefile

In the makefile for my project, I want it to copy a config file only if the file does not already exist in the destination folder. At the moment I am using: cp -n However, recently someone has ...
37
votes
8answers
4k views

Why is -r recursive necessary when copying a directory in Linux?

My question is why is it required to use the -r (recursive) flag when making a copy of a directory? I.e., why do this: $ cp -r dir1 copyDir1 When would I not want this behavior when copying a ...
0
votes
2answers
683 views

cp --update still copies unchanged files

I'm trying to copy only changed files using 'cp -pu' under Linux (Red Hat 6.1, source/destination FS are GlusterFS mounted partitions) but I found that it still tries to copy file seemingly old and ...
0
votes
0answers
12 views

Is cp -au / cp --archive --update contradictory?

I want to update a directory on a backup disk with new content added to the source, and of course rsync is too slow. cp -a does the trick but is a bulldozer; cp -u should leave existing files alone. ...
12
votes
3answers
25k 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 ? ...
0
votes
1answer
28 views

cp: fts_open: No such file or directory / Why?

I have following bash script: #!/bin/bash echo "This script will copy all JPG files inside directory '~/temp/merged':"; pwd; read -r -p "Please confirm, that you want to copy all JPG files [y/N]" ...
0
votes
1answer
50 views

Merging two directory trees with same structure, but different contents in Unix

I have two directories with the following structure: A |_0 |_1 |_2 B |_0 |_1 |_2 each 0,1,2 directory contains unique contents. I want all of the contents to simply exist as: A |_0 |_1 |_2 Is ...
0
votes
2answers
682 views

Copying all files inside subdirectories and renaming instead of overwriting

I have a number of images inside subdirectories of another directory which I'd like to copy to one single directory so all the images are in one place. After a bit of searching, I found and then ...
1
vote
1answer
110 views

AWS S3 cp does not download 40 GB file

I just uploaded a 40GB backup file from my linux EC2 machine to an S3 bucket. However when I want to download it the aws command ends with no message and nothing was copied. Here is my command: ...
0
votes
2answers
33 views

How to make a copy of file in the same directory

This creates a file in the same directy as 'some.file.bak'. find /home/ -ipath "*/temp/some.file" -type f -exec cp {} {}.bak \; How to make a copy in another name such as 'another.file' in the ...
0
votes
1answer
36 views

How to copy a list files to a list of directories or subdirectories

I'm trying to figure out how to copy a list of files to a list of subdirectories. eg. I have 300 files to copy into 300 subdirectories - 1 to 1. file1 -> dir1/sub file2 -> dir2/sub file3 ...
3
votes
3answers
1k views

How to copy one file into multiple subfolders at once on a Linux server?

I have a folder on a Linux server with 35+ subdirectories, along the lines of: aa.foo.bar.baz ab.foo.bar.baz .. bp.foo.bar.baz I have a file that I want to copy into each of those subdirectories. ...
33
votes
4answers
29k views

How can I recursively copy files by file extension, preserving directory structure?

At the Linux command line, I'd like to copy a (very large) set of .txt files from one directory (and its subdirectories) to another. I need the directory structure to stay intact, and I need to ...
0
votes
2answers
147 views

Move and rename files based on their parent's directory

I have a collection of directories that all contain a particular file that is named the same in all the directories. dir1/dirA/file.txt dir1/dirB/file.txt dir1/dirC/file.txt .... dir4/dirX/file.txt ...
6
votes
3answers
11k views

how to stop cp: overwrite './xxx' ? prompt

How can I stop the cp command from prompting to overwrite. I want to overwrite all the files with out having to keep going back to the terminal. As these are large files and take some time to ...
81
votes
6answers
60k 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 ...
0
votes
2answers
353 views

How can I copy a directories contents alone?

I want to copy the contents of ~/old contents to ~/new without the ~/old directory itself However when I do cd ~/new cp ../old ~/new or cd ~ cp -vr ~/old ~/new or cp -vr ~/old/ ~/new/ the ...
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 ...
0
votes
1answer
182 views

Mac 10.6 - Unable to cp and mv files into ~/Library/Screen Savers/

I am trying to use Terminal to copy a file into ~/Library/Screen Savers/, but every time I try to do it, it fails. My command is: cp -r Web.saver '~/Library/Screen Savers/Web.saver' and the result ...
1
vote
1answer
543 views

I/O error while cp from CD to HDD

I'm trying to create a local repo from my RHEL6 disk. Some of the .rpms I'm able to copy, others give me this error: cp: reading 'filename': Input/Output error It's the original RedHat disk, and ...
2
votes
3answers
15k 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.
1
vote
1answer
20 views

execute script with sudo and check security

I have a script, which I need to execute with sudo. #!/bin/bash cp "$@" /destionation/dir Is it a good script or someone can bypass the restriction destination dir ? Thanks for suggestions.
2
votes
1answer
111 views

copying a file to a hard link

I recently got bit by a misbehaving in a bash script of mine and was wondering: is this the expected system behavior, or is it a bug what are the ideal workarounds Essentially, the problem boiled ...
3
votes
2answers
6k views

Copying many files without stopping on errors on OSX

I need to copy several Gb from an external HD to my moan hd and some files will cause errors. If I do this with the finder, it will stop on the first error. Is there a way to copy everything no ...
2
votes
2answers
110 views

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: ...
1
vote
0answers
30 views

Why is tar|tar so much faster than cp?

For recursively copying a directory, using tar to pack up a directory and then piping the output to another tar to unpack seems to be much faster than using cp -r (or cp -a). Why is this? And why ...
1
vote
3answers
99 views

How do you distinguish a directory, and it's contents in linux?

Let's say you have this directory tree parent -----child1 -----file0 -----grandchild1 -----file1 -----file2 ...
0
votes
3answers
79 views

How to copy whole file from command line without changing destination creation time

I want to copy one file's content to another file without replacing the destination file. Because I need to retain the destination file's creation time. It is fine if its modification time gets ...
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 ...
0
votes
1answer
116 views

Can I fork a copy command on ReadyNAS SSH?

I have a ReadyNAS 102 with a couple of USB drives attached, and connecting to it from a Windows 8 machine over SSH. There were times I wanted to copy files between volumes on the NAS. Unfortunately I ...
8
votes
5answers
43k 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 ...
0
votes
0answers
171 views

Copy from Debian to mounted CIFS share hangs

I have a backup script run by a cron job on my Debian server. It creates a .tar.gz file from /home and copies it to a mounted CIFS share onto a Windows XP machine. It has been running without a ...
0
votes
3answers
196 views

“cp --parents” equivalent on Mac

The topic explains it -- basically I have a bash script used on a Linux system and a Windows system with Cygwin where the following command works perfectly: cp --parents However, running this same ...
4
votes
4answers
135 views

Why does “cp -r a/. b” behave as it does?

I thought that a and a/. is the same path. However, I've found that cp and rsync copy directory content instead of directory itself when /. is added to the source path. I also tried a/inner/..; this ...
1
vote
0answers
70 views

Maintaining peak IO potential with DD / CP

I wanted to copy a file (40 gig dataset) from a single drive to a dual disk raid-0 drive. I tried with CP and it sustained read - 4mb and write - 11 mb (doesn't make sense I know (must be the stripe ...
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 ...
0
votes
1answer
48 views

Copy specific subfolders on linux

I have similar file sturecture: /home/dave/documents/static/ /home/static/ /home/dave/pictures/static/ /home/dave/otherfolders/ ... I want to copy from this directory only folders named static. ...
1
vote
1answer
362 views

Linux: Copy files with dates in filename between two dates

I have a folder full of files where I from time to time need to copy a subset of these to somewhere else for processing. The files have the date they were created in the filename, i.e. ...
0
votes
1answer
524 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
2answers
584 views

Unix “cp -p”. Can I preserve attributes selectively?

I'd like to copy the modification and access times, but not the user ID. If I use cp -p source target It will copy everything. I'm trying to copy files to a different user but keep the original ...
1
vote
0answers
144 views

File copying times out Single User mode mac

I have an old 2009 MacBook that recently crashed. I can't boot into safe mode, but I can boot into Single User mode, verify my disk, and mount a USB drive and copy files to that USB. However, my ...
0
votes
1answer
124 views

Unix copy for each line in file

I have a file, file_copy, which has: >cat file_copy file1 file2 file3 I want to copy file1, file2, file3 from /source to /dest. One way I know how to do this is to just do: for line in `cat ...
0
votes
1answer
154 views

How do I create numbered backups?

Some GNU utils (e.g., mv and cp) can create numbered backups (foo.~1~). Others (e.g., wget) cannot. I would like to create numbered backups before running tools which overwrite files by default. Here ...
0
votes
2answers
2k views

Copy files off FreeBSD

I have a FreeBSD machine that I have to copy everything off the drive. The fielsystem is UFS and not readable by any other operating system. (great...) I have a USB flash drive (FAT32) I need to copy ...
3
votes
2answers
3k views

cp command to make bootable iso image usb

A lot of discussions exist here on making a bootable USB stick. Debian manual on installing Wheezy suggest the following: # cp debian.iso /dev/sdX # sync Making sure the USB device is first ...