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
2
votes
2 answers

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?? Thank you
Julio Fong
  • 201
  • 1
  • 3
  • 7
2
votes
1 answer

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 files) from the core folder to the merge folder, as…
2
votes
1 answer

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 servers, but we have encountered several…
elitalon
  • 209
  • 5
  • 15
1
vote
1 answer

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 problems copying certain links, e.g: sudo /bin/cp -al…
gareth_bowles
  • 9,127
  • 9
  • 34
  • 42
1
vote
3 answers

How to move and partially rename files on linux

I have versioned files which come out of a build pipeline. foo-1.3.4.war and I need to move these files to have the name foo-dev-1.3.4.war How would I go about this? I was thinking something like mv foo-*.war foo-dev-*.war but this will only…
user3383458
  • 113
  • 5
1
vote
1 answer

UNIX Copy/Move files in same directory preserving timestamp

Following is the scenario. There are multiple files in a directory created by users belonging to same unix group. Unix Group: Prod. User in Prod Unix Group: User1 User2 User3. All 3 users have same privileges. Scenario 1 If user3 wants to become…
Jolly J
  • 21
  • 2
1
vote
2 answers

what is the best approach to copy /var content

we have linux redhar 7 we want to keep the /var on other volume so the plan is to: mkdir /var_copy cp -rp /var/* /var_copy umount /dev/mapper/vg-a-var /var rm -rf /var mkdir /var mount /dev/mapper/vg-b-var /var cp -rp /var_copy/* /var so my…
jango
  • 59
  • 2
  • 3
  • 12
1
vote
2 answers

Most side effect-free way to archive a large file while it is being modified

I am looking after an application that generates a large amount of data in a log file (about 5G a day) on a Red Hat server. This process runs for 24 hours during the week, so there is no point in the day when the file is not being modified, although…
1
vote
1 answer

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 folder via sshfs and use that to transfer files,…
jlacroix82
  • 121
  • 5
1
vote
1 answer

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 them. Since we cannot replace these directories…
1
vote
1 answer

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
Tom
  • 731
  • 3
  • 11
  • 24
1
vote
3 answers

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 before this, I also want to estimate the time it…
Julien Genestoux
  • 609
  • 8
  • 19
1
vote
3 answers

Copy all files to another location

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 files. There are around 50 employees. I want to copy all those files…
shantanuo
  • 3,579
  • 8
  • 49
  • 66
1
vote
1 answer

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 some point in the copy load will spike out of…
Zach W
0
votes
1 answer

using find, exec and cp to copy specific files while preserving directory path

I set up the following folders with empty text files: 1/a.txt 2/b.txt I want to copy only txt files to another directory while maintaining their directory structure. So I tried the following commands: mkdir -p temp/s; find ./ -name '*txt' -exec cp…
John
  • 7,343
  • 23
  • 63
  • 87