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

learn more… | top users | synonyms

0
votes
0answers
21 views

Bios flashing : copying exe to bootable external hd (cannot create regular file, read only filesystem)

I want to flash my bios so I can reset it with HP super+b boot bios reset. I downloaded the .exe flash. I created a Windows PE iso and burned it on a external HD that I will boot on, using the 'dd' ...
0
votes
1answer
17 views

Copy Files From Flash Drive To Ubuntu

I am attempting to copy files from my flash drive to my local drive on Ubuntu. This is the command that I ran sudo cp -i /media/owner/ESD-USB/mysql /var/lib/ But that output a message of - and ...
2
votes
1answer
53 views

cp only files, skipping directories

Using cp to copy files from a directory that has an empty directory in it as well results in error return value, which fails my script. Is there a way for it to just skip the directories without ...
1
vote
1answer
48 views

Copying files while SSHed onto a computer

I am trying to upload some website files to a computer I am SSHed into and I'm not sure the correct command to use. I've tried looking up the cp command instructions but I can't work out what to put ...
1
vote
1answer
18 views

How to copy file only if file sizes between src/dst differ?

I wish to perform a file copy like: cp --verbose /srcfile /dstfile But I only wish to perform the copy if dstfile does not exist or if the dstfile filesize differ from the filesize of srcfile. How ...
1
vote
1answer
38 views

Replace multiple files recursively

I have a file structure like this: experiment/ ├── foo.txt ├── source-foo.txt └── subdir └── foo.txt I want to take the file source-foo.txt and replace the other foos with it. Just like doing ...
0
votes
0answers
47 views

Copy files and replace a directory

I have the following file structure that comes out of my continuous integration tool: stage/acme-plugin/target/acme-plugin-1.0.0.jar stage/example-plugin/target/example-plugin-2.5.0.jar but what I ...
0
votes
0answers
29 views

Copy whole directory including contents to a new dir, as a sub dir

I wish to copy an existing dir (and its contents) as a sub dir of a new dir. Unfortunately with the following command it is copying just the loose files to the new dir. The new dir is not pre-...
2
votes
1answer
22 views

Terminal: cp -r with directories with same name and different case

I'm trying to copy around ~250Gb from one drive to another. Catch is that the destination drive is formatted in NTFS or FAT or something and isn't case-sensitive, and I've got folders I need to copy ...
0
votes
0answers
22 views

Grub won't recognise USB stick

I am trying to boot to a USB stick using this guide. But unfortunately Grub won't recognise my usb stick when I type root ([tab], 0). Is there any way to solve this issue? I've tried copying the files ...
4
votes
2answers
280 views

How do you copy directories in Linux in these situations using cp?

Situation 1 How do I copy /home/src/somedir to /dest/ such that the path always ends up as /dest/somedir, regardless of whether /dest/somedir already exists? I want to avoid ending up with /dest/...
0
votes
1answer
74 views

missing destination file operand when cp

i tried to use the Linux alias: rm='cp $* ~/dustbin; rm $*' but it reported 'missing destination file operand after ~/dustbin' , why didn't cp recognize ~/dustbin as destination ?
0
votes
2answers
36 views

Reference cells in column of .csv from command line

I have a column B in my.csv in which each cell references the filename of a document in a directory source_directory/. I'd like to grab each of those names so I can use them as args for other shell ...
0
votes
1answer
16 views

Zsh: prepend $(<list.txt) args with a directory

I'm using cp $(<list.txt) new_folder to copy a list of files (filenames in list.txt) to a new folder. As is the files must be in the same folder as list.txt. Is there an easy way to make this work ...
1
vote
3answers
518 views

how to copy a directory (folder and its contents) to another directory?

Here is my file structure: - someDirA - folderOne - folderTwo - somefile.txt - someotherfile.txt - someDirB - somefolder What I want 'someDirB' to look like: - someDirB - ...
0
votes
0answers
37 views

Ubuntu file copy fake success?

I am using Ubuntu 14.04. When copying a big folder with lots of files and sub folders from my NTFS U disk to my hard drive, the progress bar indicates that copy is finished. But the destination ...
0
votes
1answer
33 views

Copy matches of recursive search to a new location

I want to search a directory recursively and copy all XML files to a new location. I can identify the files with: ls -R | grep .xml$ or with full paths with: find . -name \*.xml Results of ...
1
vote
1answer
35 views

Keyboard command in shell for skipping file during copy

Probably a stretch but is there a keyboard command that is accepted by cp from the shell (using bash/zsh) to skip a currently copying file for example if I am recursively copying a folder structure of ...
0
votes
0answers
146 views

Linux cp command: Auto-rename files, windows-like, FAT32, file name restrictions, ignore symbolic links

Linux cp command: How can I auto-rename all files to conform to windows or FAT32 formatted device file name restrictions, and ignore all symbolic links? I am trying to copy the contents of my dropbox ...
1
vote
2answers
780 views

OS X - copy files issue - Resource busy

Calling all OS X experts. I copied two 1Tb drives (ex-Windows) onto a new 2Tb USB 3.0 drive using Finder on the Mac (OS X 10.9). The 2Tb drive is now about 90% full. I now want to duplicate that ...
2
votes
2answers
974 views

Linux cp command is not silent

I know with a -f cp should be silent but it's not! I do cp -rf Functional Functionalssssssss and if Functional does not exist, it says cannot stat 'Functional'... but I just don't want to see the ...
0
votes
2answers
115 views

Laptop fan not turning on for graphics

About two years ago, I purchased a samsung series 5 (not the ultra book, the NP510r5e). Every now and then, when there I run something graphically demanding, the laptop just shuts down. I first ...
6
votes
2answers
1k views

Rsync copying current directory with name

I want to copy current directory to my backup directory: I tried this command rsync -a . ~/backup/ but it just copies the current directory contents instead of creating new directory at the ...
1
vote
0answers
230 views

cp: cannot stat error - when filename has Asian characters

I am simply trying to copy files using cp -r /home/user/source/ /home/user/destination/ but it throws me the cp: cannot stat /source/filename.xxx error for some of the files. When I searched for this ...
0
votes
1answer
574 views

Linux Bash: Moving/Copying files/directories by timestamp

This is the command I am using: find absolute-path -name "*" -amin -120 -exec cp -f absolute-destination {} \; I’m trying to copy a lot of directories from a directory to another directory, but ...
0
votes
0answers
40 views

how to update a directory that is a mirror of another one (with hard-links)?

I like using cp -rl dir1 dir2 to make a recursive copy of dir1 into dir2 (using hard links to save storage, and usually followed by rsync to make progressive backups). The issue is that, if dir2 ...
0
votes
1answer
340 views

In Linux copy file and overwrite only if target is older [duplicate]

How in Linux using cp one can copy file to destination, but if destination exists, then overwrite only if destination is older than source? cp -f always overwrites, but overwrite is needed only if ...
-2
votes
2answers
113 views

Copy sequential files into sequential directories

I need to copy multiple, sequential files into sequential directories. The files have the julian date (day of year) with other info in the file name. The directories are listed by julian date (day of ...
0
votes
1answer
121 views

How to cp multiple file extensions?

How do I cp multiple file extensions, like png, jpg and tif files? I tried: $cp ./*.(jpg|png|tif) ../output/ >bash: syntax error near unexpected token `(` $cp ./01_reliefs/*.\(jpg\|png\|tif\) ../...
1
vote
2answers
283 views

Wildcard not working in cp command when using exec

I want to copy all the files in all the directories to the parent directory, but I get the error ./img/* is not a directory For example. Here is the command that I used. Is there a better way to do ...
0
votes
0answers
34 views

cp file in /dev/sdc, now drive isn't readable

So I was trying to instal Arch on my Laptop, and I wanted to copy boot.efi into my usb. cp boot.efi /dev/sdc cp boot.efi /dev/sdc1 cp boot.efi /dev/sdc2 and now its not being read. How can I fix my ...
0
votes
1answer
154 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 /Volumes/...
0
votes
1answer
3k 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: [root@xxx.xx....
1
vote
1answer
500 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?
39
votes
8answers
6k 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 ...
1
vote
0answers
147 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. ...
0
votes
1answer
376 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
2answers
326 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
59 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 -...
1
vote
2answers
978 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 ...
0
votes
1answer
2k 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 ...
4
votes
1answer
790 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 can'...
1
vote
1answer
110 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
888 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
1answer
397 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 ...
0
votes
3answers
107 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 ...
5
votes
3answers
6k 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 fine....
0
votes
1answer
203 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 ...
4
votes
4answers
229 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 ...
4
votes
2answers
409 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: ...