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

learn more… | top users | synonyms

0
votes
1answer
6 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.
1
vote
3answers
94 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 ...
1
vote
1answer
16 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: ...
60
votes
5answers
43k 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
3answers
60 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
7k 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
46 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
39k 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
2answers
45 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
26 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
80 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
110 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
111 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 ...
3
votes
2answers
3k 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 ...
1
vote
1answer
53 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
68 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
4k 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
0answers
56 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
42 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
214 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
489 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
240 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
105 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
81 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
86 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
106 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 ...
2
votes
2answers
2k 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 ...
29
votes
3answers
24k 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 ...
2
votes
2answers
88 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
2k 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
306 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
4k 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
345 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
79 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
404 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
419 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
4answers
609 views

Copy the contents of a directory into another

I would like to copy the contents of a directory into another. I don't want to copy the directory and all files and directories under it, but just the contents of the directory just as if it were a ...
0
votes
1answer
367 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, ...
0
votes
2answers
140 views

Different performance for different USB 2.0 devices

I copied a 3.5GB file from my SATA HD to my Seagate USB 2.0 external HD in about 3 minutes. I copied the same 3.5GB file from my SATA HD to my USB 2.0 SanDisk Cruzer and it took more than 15 minutes. ...
1
vote
2answers
849 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
262 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 ...
6
votes
3answers
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
174 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
2k 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
2answers
1k 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 ...
12
votes
3answers
282 views

Reuse text on a bash command

If i'm writing a long command or just typing an extensive file path, is there any that i can "reuse" it with some command shortcut? e.g: 1.cp /home/myuser/really/big/file/here/and/there.png ...
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
512 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 ...
2
votes
1answer
635 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 ...