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

learn more… | top users | synonyms

1
vote
2answers
31 views

Recursive, Non-Overwriting 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
15 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
0answers
21 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 ...
4
votes
4answers
98 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
1answer
25 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: ...
0
votes
3answers
74 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 ...
0
votes
0answers
40 views

ISPmanager - change panel access to subdomain

I have a question regarding ISPmanager control panel. It is similar to Plesk and CP, so I use ISPmanager Lite. There is an option in the panel settings tab to change the panel address. All I want to ...
0
votes
1answer
41 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
146 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. ...
1
vote
2answers
134 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
93 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 ...
2
votes
1answer
73 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 ...
0
votes
1answer
64 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
74 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 ...
2
votes
2answers
1k 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 ...
2
votes
2answers
87 views

I somehow made our linux box's “CP” command act differently than the default, how can I revert it back to default?

Title explains it; Somehow in installing the 'z' directory jumper, I made our linux machines CP command act strangely (for example: it no longer prompts for overwrites, it auto-forces it whether we ...
0
votes
5answers
1k views

Moving a file using PuTTY

I am newbie struggling to move a file on a Linux VPS using PuTTY. I can log in with a user in PuTTY at this point I can navigate to see the file I wish to move ...
1
vote
1answer
226 views

Copy files and rename them by creation date

i have a few directories (1 level) that were added to my server in specific times. the problem is, they are named as a random hash. would it be possible to copy them somewhere and rename by the ...
2
votes
1answer
3k views

Why do we use cp to copy files and not dd? (in unix-derivatives)

For normal file copying in *nix, I've only ever seen people use cp (eg. cp /mnt/mydevice/myfile ~/myfile), but I eventually ran into dd, which appears to do the exact same thing (dd ...
2
votes
1answer
241 views

How to preserve file-create-timestamp while copying files on OS X from command-line?

On OS X when you a copy a file using Finder, the target file has the same creation and modification times as the source file. However when you do so using cp in Terminal both creation and ...
2
votes
2answers
68 views

Running cp -r ~/.ipython ~/some/path/.ipython a second time creates ~/some/path/.ipython/.ipython. How to prevent that?

I am using a script to copy directories to a specified location. When I run cp -r ~/.ipython ~/some/path/.ipython the .ipython dir is copied as expected to the specified location. But when I run this ...
0
votes
1answer
328 views

cp all files in the same directory, but exclude subdirectories/files

I'm looking for a way to do something like this: cp -R jquery-ui-1.10.3/themes/base/minified ui ..but to let it match all files in the minified folder (and only it's root) and except all ...
1
vote
1answer
314 views

Unix command for recursively copying files

I need a unix command for the following: Directory Structure /project /images /products /cup.jpg /laptop.jpg /designs /alpha.jpg ...
0
votes
1answer
310 views

can not copy big file to usb device

I mount usb device like this: sudo mount /dev/sdb1 /media/usb and then copy a big file which about 1Gb to the device: sudo cp ~/big_file /media/usb Ordinary, if I copy a big file to usb, ...
1
vote
2answers
756 views

How to copy files in Terminal without writing failures?

I have an external HD that has crashed, and is badly corrupted. I want to copy whatever is intact off of it, which means doing so in Terminal as the Finder will of course give up at the first ...
0
votes
2answers
213 views

How can I copy (cp) a directories contents without the directory itself

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 ...
0
votes
1answer
161 views

cp - copying and keeping different version

How to copy all .aze files that have different contents into folder3 ? The screen show what I don't want to do. What I want to get close is to have in folder 3, file1(1).aze and file1(2).aze (and ...
0
votes
2answers
1k views

Why does my Bash script display the “too many arguments” error at the cp command?

Here is my script, I get the error "line 33: [: too many arguments", I'm confused why, surely only 2 arguments are being provided to cp here? I am providing two directories to the script with no ...
1
vote
3answers
2k views

Copy multiple files via cp from a string

I'm trying to copy multiple files to a directory from within a shellscript. These files contain all sorts of "ugly" characters, such as whitespaces, brackets and what not else. However, I'm stuck when ...
0
votes
1answer
409 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
2answers
917 views

cp into destination hierarchy with symbolic link?

I am trying to write a site deploy script that will copy files like so: SOURCE . .. src/ html/ DEST . .. src/ html/ -> /var/www/ftproot/mysite I want the files in SOURCE html to go to DEST ...
2
votes
1answer
477 views

ssh Mac Unix: copy a file with special characters and spaces

I am remote logged into a Mac and trying to copy a music file from one directory to another, but I am getting an error. I think it's caused by spaces or special characters, but not sure. the file ...
-5
votes
1answer
200 views

How to copy a list of files from one directory to another and modify the destination file name on the fly

Could you propose a way to copy a list of files from one directory to another. During copying the script should capitalize the first letter of the filename and lowercase all other letters.
1
vote
2answers
942 views

How to Copy Large Directory to External Hard Drive Linux

I've formatted a 3TB external hard drive as ext4 using fdisk (actually gnu fdisk), mounted it at /media/external and am trying to copy my entire home directory to it. My first attempt I thought was ...
0
votes
1answer
332 views

cp -r overwrite

This is not a problem as much as my curiosity of the different cp -r behavior. This is on the latest Ubuntu. I have an outdated copy in a directory with several subdirectories. I'd like to update the ...
0
votes
1answer
26 views

backup time machine style

I would like to find a more solid and handy solution to my small problem.. My idea is to backup every midnight my home directory incrementally, so I want only the modified files (of today) to be ...
0
votes
1answer
153 views

Using find command with recursive copy without -r or a while/for loop

I have the following problem. Normally one would use the command find exec cp -r to copy everything from one directory to another. In this case I am not allowed to do so, or use a while/for loop for ...
1
vote
2answers
349 views

Get all files from a directory without read permissions?

In Linux/Unix, if I am inside a directory of another user, but cannot view the contents of the directory by typing "ls," how do I get a copy of all the files? Is the only way to guess what the file ...
1
vote
1answer
68 views

how to join paths to {} inside an -exec option of a find command?

//// SOLVED //// I'm trying to copy several files scattered in a directory structure to another one where such files already exist but without write permission allowed. So I used a find command with ...
1
vote
1answer
143 views

Original files corrupted from cp, maybe bad hard disk

I've been having a big problem with corrupted files on my machine. I'm running Debian Wheezy (very minimal install) on an Acer Aspire One netbook. I've been trying to download a 200 mb file. The ...
0
votes
2answers
395 views

xargs and cp: find-style “{}+” multiple expansion?

I'd like to copy a group of files to destination folder. But without needing to spawn a new instance of cp for each operation. The arg format for cp seems to be: cp src_file1 src_file2 src_file3 ...
1
vote
0answers
401 views

How can I copy files recursively without overwriting the directories

On linux, let's say I have some files like this: dir1/file1 dir2/file2 and I want to copy them to a destination that already have dir1 and dir2 and looks like: dir1/file1 dir1/file1a dir2/file2 ...
3
votes
3answers
2k views

Linux: Copy all files by extension to single dirrectory

I am trying to copy all *.tif files from ./old to the ./new. In ./old i have lots of subdirs with different files, and in ./new i need only TIF files, without folder tree. So, I had tried cp -vR ...
1
vote
1answer
445 views

Is there a shortcut for unix `cp` to copy a file to the current directory with the same filename?

I'm hoping there's a shorter way of copying a file from a given directory to the current working directory than typing cp /path/to/file.txt file.txt I tend to use this command a lot, and reiterating ...
0
votes
0answers
91 views

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 ...
2
votes
4answers
901 views

Using cp command in linux shell, how do I copy a whole directory into another directory?

I have a directory, let's say, "work": ~/work/ This directory has some sub-folders (d1, d2...) in it and files in these sub-folders. I want to make a backup copy in the same folder, so it would be ...
3
votes
2answers
7k 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 ...
2
votes
3answers
152 views

In Power SHell set alias cp to cp -v

I have cp for power shell. But I want to use cp in verbose mode without writing -v. So cp should be aliased to "cp -v" command. How to alias cp to "cp -v" in power shell?
1
vote
0answers
153 views

shortcut to recursively copying a directory preserving modes, ownerships and hard and symbolic links

I am using the following to recursively copy a directory while preserving modes, permissions as well as hard and symbolic links: cp -pr --preserve=links dir-a dir-b However I have the following ...
3
votes
2answers
2k 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 ...