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

learn more… | top users | synonyms

1
vote
2answers
2k 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
2answers
148 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. ...
-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 ...
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 ...
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 ...
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.
1
vote
1answer
1k views

cp -a is preserving ownership, from non-root user

When I invoke cp -a 1 2 from a non-root user, the ownership is being preserved, despite the fact that file 1 belongs to another user. My understanding was this shouldn't be possible. What is going on?...
1
vote
1answer
1k views

permission denied while copying files with root

Ok, how is it possible that I get perm denied when I'm copying files in console. Any ideas?
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 ...
0
votes
1answer
413 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 ...
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 ...
1
vote
0answers
148 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. ...
1
vote
0answers
256 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 ...
1
vote
0answers
1k 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 ...
1
vote
0answers
265 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
0answers
71 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
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
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-...
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 ...
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
0answers
147 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 ...
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
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
0answers
130 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 ...