cp is the command of the Unix operating system that is used to copy files.
0
votes
1answer
11 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 ...
17
votes
4answers
13k 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 ...
5
votes
6answers
2k 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 ...
1
vote
1answer
58 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
423 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
57 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
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. ...
1
vote
2answers
79 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
24 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
2k 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 ...
3
votes
3answers
2k 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
38 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
172 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
206 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
246 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
247 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
98 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
151 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
90 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
326 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
99 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 ...
2
votes
3answers
315 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 ...
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
115 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
110 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 ...
10
votes
3answers
11k 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 ...
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
103 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
176 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
180 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
4answers
290 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
1answer
175 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 ...
1
vote
2answers
8k 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
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
107 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 ...
4
votes
5answers
20k 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
413 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 ...
20
votes
6answers
35k 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 ...
1
vote
1answer
138 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 ...
4
votes
3answers
10k 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 ?
...
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
170 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
580 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 ...
0
votes
2answers
440 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.
...
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 ...
4
votes
2answers
5k 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 ...
7
votes
3answers
7k 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 ...



