cp is the command of the Unix operating system that is used to copy files.
2
votes
1answer
25 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
15 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
60 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
58 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
83 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
26 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
39 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
183 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
269 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
100 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
214 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
152 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
92 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
329 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
100 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
20 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
116 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
112 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
32 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
104 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
177 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 ...
0
votes
0answers
181 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
...
2
votes
3answers
323 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
176 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
63 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
291 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 ...
1
vote
2answers
1k 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
119 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
108 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 ...
1
vote
1answer
417 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
143 views
Copy files from a numeric range to another folder
Slightly stumped on what CP command would copy files numbered 14 trough 39 into a directory called Volume2 from the following example:
01.mp3 04.mp3 07.mp3 10.mp3 13.mp3 16.mp3 19.mp3 22.mp3 ...
3
votes
2answers
1k views
How do you use regular expressions with the cp command in Linux?
I am attempting to only copy a subset of files from one directory to another using cp however am greeted with the message cp: cannot stat [^\.php]': No such file or directory. Is there a way to use ...
0
votes
1answer
174 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
3answers
105 views
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 ...
0
votes
1answer
586 views
Symlink all files in a Folder to a new Folder
Ideally what I am seeking is a way to rename all my anime keeping original files intact without using extra data space
The solution I can think of is creating a duplicate folder path to another ...
3
votes
2answers
3k views
Linux permissions and owner being preserved with cp
I can't understand the following behavior:
I have a file named someFile under /opt/com/internal/someFile
If I do ls -all /opt/com/internal/someFile the permissions are 700 user:userGroup
I am root ...
1
vote
1answer
481 views
Using a Linux/Unix terminal to copy many files to a new location
I'm trying to use the a Linux terminal to copy many files to a new location. I tired the command:
sudo locate -i *file_I_want* | xargs cp $1 /place_I_want_everything_copied_to/
Which, gives an ...
1
vote
3answers
78 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
0answers
62 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 ...
0
votes
2answers
103 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. ...
0
votes
1answer
4k views
Can't create directory, “permission denied” error
I am executing the following command from my Linux machine.
cp -r hwweb-ws-5.0 /home/tomcat/hwweb-1/webapps/
It's displaying the following error:
cp: cannot create directory ...
4
votes
3answers
582 views
Multi-core and copy speed
What i want to do is to copy 500K of files.
I want to copy within server from one destination to another.It includes emails mostly so many small files.
Its over 23 GB only but takes so long (over ...
0
votes
2answers
223 views
Copying a file only when it is newer than the destination
How do I copy a file in Linux only when the file being copied is newer than the version at the destination?
If the file at the destination is newer, I want the file copy to not go ahead.
2
votes
3answers
650 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. ...
1
vote
1answer
410 views
Don't copy files that cause an input/output error
When copying files from a faulty hd with cp, rsync, or scp, the faulty files which can't be read anymore are also partly copied to the destination directory.
Is there an option to automatically skip ...
1
vote
3answers
709 views
Linux: how to copy a file with a certain name pattern for which the exact place in the complex directory-structure is unknown
I want to copy all files with the name XYZ* into one folder. The problem is that the files are in different subfolders and that not even the depth of the folder structure is the same for all files. ...
2
votes
1answer
75 views
Copy everything in a subdirectory across to the relevant subdirectory elsewhere
At the moment I'm doing:
for i in mdx/[0-9][0-9].png; do cp $i ../../d_s_c/images/mdx ; done
But as well as the directory mdx, I also have other directories called ntt, etc.
How can I say 'For ...
1
vote
1answer
117 views
Pass wildcard array to cp
I need help with passing a wild card array to cp, I know it can be done but cant figure it out,
ive got 3 files all start with the word somefile but have 3 different extensions
somefile.conf
...
1
vote
1answer
326 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 ...
0
votes
2answers
102 views
cp command can't find some directories
I'm trying to copy a bunch of files/directories using a terminal command, cp. The command I'm using is:
sudo cp -r *.tests ~/Desktop
tests are directories with stuff in them. However I get a few ...

