Questions tagged [cp]

cp is the copy command.

For *nix:

Copy one or more files to another location

Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.

manpage

For Windows

Allows the user to copy one or more files to an alternate location.

More info here

71 questions
46
votes
10 answers

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 either in csv or any other text format. What I…
Jestep
  • 633
  • 1
  • 6
  • 11
37
votes
2 answers

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 be assigned on the destination server. I need to…
shantanuo
  • 3,459
  • 8
  • 47
  • 64
35
votes
6 answers

cp without overwriting destination permissions

How do you use the cp command without changing the target file's permissions? For example: cp /tmp/file /home/file I don't want to change chown and chgrp on /home/file.
David
  • 423
  • 2
  • 6
  • 12
28
votes
1 answer

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 also be able to access other parts of the VPS…
dukevin
  • 1,610
  • 3
  • 18
  • 25
24
votes
4 answers

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)?
Phil
  • 1,839
  • 6
  • 27
  • 33
23
votes
3 answers

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'. The command I am using is: cp -r…
Faisal Vali
  • 333
  • 1
  • 2
  • 7
22
votes
6 answers

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: cp -R .* directory but it recognizes . and .. and…
Zifre
  • 439
  • 1
  • 6
  • 11
14
votes
6 answers

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 rsync also does lots of things with checksums to…
Amandasaurus
  • 30,211
  • 62
  • 184
  • 246
12
votes
5 answers

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 stopped due to a network problem that is now…
Andrew Johnson
12
votes
2 answers

cp -p will preserve times for some files but not all?

I have a source directory on a machine with a bunch of files, all with the same permissions, that I want to copy to another directory, that is mounted via SMB. [tmark@dexter JR09141045 roche_454_transfer]$ ls -l /source_dir total 71348 -rwxrwxrwx 1…
tmark
  • 121
  • 1
  • 1
  • 6
12
votes
3 answers

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 another, then run the copy again but only updating new…
Ben Everard
  • 569
  • 3
  • 7
  • 21
7
votes
3 answers

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 advice?
bobby
  • 604
  • 4
  • 13
6
votes
4 answers

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 (logs...). Used data size of the volumes is between…
skinp
  • 749
  • 1
  • 7
  • 19
6
votes
5 answers

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 better to use cpio and when to use tar? Similar…
Tim
  • 1,467
  • 3
  • 25
  • 38
5
votes
2 answers

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 permissions for `blah.txt': Operation not…
JT.WK
  • 431
  • 6
  • 18
1
2 3 4 5