cp is the copy command.

learn more… | top users | synonyms

14
votes
9answers
34k views

Linux (mv or cp) specific files from a text list of files?

I have a directory of many files, something like 50,000 pdf's and other files on a server. I need to move specific ones to another directory. I can generate a list of the files that need to be moved ...
13
votes
6answers
7k views

Unix copy command that has a progress bar, but not as heavy as rsync

I need to copy lots of files. Usually I use rsync because I pass it the -aP options and I can see (a) how many files are left to process and (b) how much of each individual file is copied. However ...
9
votes
5answers
13k views

Recursively copying hidden files - Linux

Is there an easy way to recursively copy all hidden files in a directory to another directory? I would like to back up just all the settings files in a home directory, not the normal files. I tried: ...
8
votes
1answer
4k views

SFTP: file symlinks in a jailed (chrooted) directory

I'm trying to set up sftp so that a few trusted people can access/edit/create some files. I have jailed a user into their home directory (/home/name) but have run into a problem. I want for them to ...
8
votes
5answers
3k views

resume file copy linux

How do I resume a copy of a large file in linux? I have a huge file (serveral gigabyes) partially copied to a network drive, and it took a long time, and it was mostly done before the copy operation ...
7
votes
2answers
13k views

Turning off cp (copy) command's interactive mode (cp : overwrite ?)

Does anyone know how I would turn off the interactive mode when using cp? I am trying to copy a directory recursively into another and for each file that is getting overwritten I have to answer 'y'. ...
6
votes
3answers
2k views

Continue aborted cp

Is it possible to run cp again after it was aborted and make it start where it ended last time (not overwrite data that's already copied, only copy what's still left)?
5
votes
3answers
3k views

Linux file copy with ETA?

I'm copying a large amount of files between disks. There's approximately 16 GB of data. I'd like to see progress information, and even an estimated time of completion from the command line. Any ...
5
votes
2answers
2k views

Ubuntu cp -p on mounted ZFS pool

On my Ubuntu server, I have several automounted zfs pools. The problem that I have, is that when I try to copy a file while preserving permissions, I get the following error: cp: preserving ...
4
votes
2answers
6k views

preserve permission with scp

SCP does not seem to preserve ownership stamps even if used with -p option. scp -p /mysql/serv/data_summary.* some_server:/mysql/test/ The files are owned by mysql and I want the same ownership to ...
4
votes
3answers
2k views

Best way to copy large amount of data between partitions

I'm looking to transfer data across 2 lv of an HP-UX server. I have a couple of those transfers to do, some of which are mostly binary (Oracle tablespace...) and some others are more text files ...
3
votes
3answers
1k views

Creating an iso file in Linux

I have created iso files by using two commands: dd if=/dev/cdrom of=filename cp /dev/cdrom filename What's the difference between the two, both have worked for me.
3
votes
3answers
1k views

cpio VS tar and cp

I just learned that cpio has three modes: copy-out, copy-in and pass-through. I was wondering what are the advantages and disadvantages of cpio under copy-out and copy-in modes over tar. When is it ...
3
votes
1answer
978 views

cp -R source_dir/* dest_dir/ does overwrite files?

I am trying to copy, recursively, the content of a directory to another using: cp -Rv source_dir/* dest_dir/ It seems that everything work ok but when I list that directory with ls -l the change ...
2
votes
3answers
939 views

cp command, ignore unchanged files

Is there a way to do a cp but ignoring any files that may already exist at the destination that aren't any older then those files at source. Basically I want to copy the contents of one disk to ...
2
votes
1answer
920 views

What does the message, “too many links” mean when using CP on Linux?

I am copying 25,000 folders containing hundreds of files each from one hard drive to another on the same Linux server. The destination folder already contains 25,000 different folders full of their ...
2
votes
1answer
93 views

RSYNC Slow / Copy only changed files?

I have a server that maintains thousands of log files that are nested in thousands of directories. At the moment, I am using RSYNC to copy those log files to a web server where I parse them and make ...
2
votes
2answers
200 views

Copy entire filesystem in a folder where a raid-1 array is mounted

I am trying to migrate from a single disk drive system to a double disk drive software raid-1 system that already has a running system on it. Meaning that formatting and having a new installation of ...
1
vote
2answers
3k views

What's faster for copying files from one drive to another? [closed]

Running linux. I have two identical drives mounted on the same machine. What is faster CP, MV, or RSYNC? Why is one faster than the other? Are there any faster alternatives?
1
vote
3answers
706 views

Estimating the time needed to copy a big file

I have to copy a relatively big file (6GB) to another server. To enforce consistency, I have to 'lock' this file and not use it during the transfer. I obviously want to minimize this downtime, but ...
1
vote
1answer
538 views

/bin/sh: /bin/cp: Argument list too long

I have problem with this command: 'cp' -fr /www/*-aws/* /www/mainhost/aws/awstatstotals/tmp/ Error is Argument list too long - I know many /www/-aws/ folders. I know that I can use FIND command, ...
1
vote
1answer
1k views

copy and replace to folders to another fastest way - linux bash

I have a three folders: core, project and merge with many files inside. I want to delete all files and folders (including dot files) inside the merge folder, and then copy all files (including dot ...
1
vote
1answer
254 views

Replacing directories that are subversion-monitored

We're trying to update an installed software which we have under control by subversion. The update instructions for the software require replacing several directories that have .svn directories in ...
1
vote
1answer
211 views

Does cp -p apply to the source or destination file?

When I use -p to preserve the file permissions of a file being copied, does it apply to the source or the destination file (if it already exists)? Thanks
1
vote
2answers
677 views

cp from local to usb-drive affects desktop performance

Background While copying a vast number of multi-megabyte sound files, the Kubuntu desktop becomes intermittently unresponsive (the mouse pointer can move, but Firefox, Konsole, and KDE itself ...
1
vote
1answer
281 views

Server Load Spikes On File Copy — Server Goes Unresponsive

This has been a problem that we've been battling for some weeks. Whenever large files are copied on the server (both with rsync and cp) the server load initially goes up to 6 or 8 and stabilizes. At ...
1
vote
3answers
114 views

Copy all files to another location [closed]

I have a folder called "employee" and within that folder there are sub-folders with each employee name. employee >> amar >> akbar >> anthony Each of these folders contain 1 or 2 ...
1
vote
1answer
580 views

Getting Linux copy to handle failing links

I just started using the nifty rsnapshot utility for backups to our NAS. I really like the tool (which uses rsync and links unchanged files to keep the backup size down), but I'm running into ...
1
vote
3answers
2k views

Performance problem with QNAP TS-410 NAS

We have a QNAP TS-410 in our office. Its hardware is: 256MB DDR2 RAM CPU Marvell 6281 800MHz 4 x 1.4GB Seagate SATA disks mounted on RAID5 We thought it would be sufficient to make backups for our ...
0
votes
1answer
147 views

New external backup drives - first time backup - cp or rsync

I've just bought a clutch of external drives to start a rotating backup of my photography work, and wonder if I should just do a straight copy the first time around, or if rsync would be the better ...
0
votes
3answers
84 views

How can I copy all files in one tree to another tree except those matching a pattern?

I have a directory tree under ./src/ I have another matching directory tree under ./work/ I'm trying to copy all the files in src to work, while keeping the directory structure and excluding all ...
0
votes
3answers
2k views

copy and rename files

Here are my access logs those I want to backup. /var/log/httpd/access_log /var/log/httpd/access_log.1 /var/log/httpd/access_log.2 /var/log/httpd/access_log.3 ... I want to copy all these files but ...
0
votes
2answers
385 views

How to clone with cat?

I want to clone an 8.1gig bootable disk to an 8.0gig disk and have the clone remain bootable. dd causes problems because the destination disk is a few mb smaller than the source. Can "cat" help me ...
0
votes
1answer
527 views

Improve RSYNC scan speed / Alternate approach?

I'm using rsync to transfer application log files from one server to another. It works fine with the exception that scanning the directories takes forever. I have around 160,000 log files and a few ...
0
votes
2answers
1k views

Linux Shell - How to copy directory without symlink

I would like to get everything inside one directory. How can I copy entire directory (that originally contains files and symlinks) to a new directory that should contains all files but no symlink?? ...
0
votes
1answer
451 views

file copy error from system to cifs mount

When coping a file greater than 64kB from an Ubuntu server to a CIFS mounted windows share, most of the data is copied, but it seems the last chunk doesn't get copied. The size doesn't match, and the ...
0
votes
1answer
237 views

Reverse and modify copy file to all subfolders command, xargs

i found this online it copy file to every sub folder on the current dir for full tree depth find -maxdepth 1 -type d -print0 | xargs -0 -n1 cp -v .htaccess now would be nice if it could ask if ...
0
votes
2answers
72 views

Copy data to a directory

I use the following command to copy data and it is working as expected. cp -pr --reply=yes /db-nfs/mysql3/* /db-nfs/mysql5/ 1) Is there a better way? 2) I want to copy the same data to ...
0
votes
2answers
34 views

SecAst: Potential documentation issue, Ubutunu 12.04.4 LTS and the command: cp -v

To Generation D: I am writing you about what might just be a documentation issue which hopefully doesn't have significant repercussions. This is something I encountered immediately at the start on ...
0
votes
1answer
477 views

nfs file transfers fail, “cp: cannot stat 'dir_name': No such file or directory” but sshfs works fine

We have a strange issue on our file server (Debian Wheezy 32-bit), where some files within folders contained in an nfs share fail during transfer using the cp command. Howerver, if we mount the same ...
0
votes
1answer
148 views

Linux cp with gzip and numbered backup in one step?

I'm wanting to copy a file and gzip it in a single command/step But I want to do numbered backup if the file already exists i.e. "cp --backup=numbered" or similar. The reason for the single step is ...
0
votes
2answers
49 views

Copy latest created directory

I would like to make a second backup from the latest created backup. So I tried the shell command: last='ls -tr | tail -1' cp -r /path/.../"$last" /path/.../backup/ but it copies a randome backup. ...
-1
votes
3answers
262 views

CP command making recursive directories [closed]

Okay so what I'm trying to do is that I have a file and I have to replace about 100 files in the location: /home/*/service*/files/ using that file recursively. I used the following command: cp -r ...
-1
votes
1answer
261 views

Rotating Backups with RSync and CP - Excludes not working perfectly

My script looks essentially like this: cp -al $yesterdays_snapshot $todays_snapshot rsync -vadlH --exclude-from excludes.rsyc $source $todays_snapshot This works great except for one problem: If ...