Questions tagged [cp]

cp is a UNIX command used to copy a file

Description

cp copies SOURCE to the destination DEST, or multiple SOURCE(s) to directory DIRECTORY.

Syntax

cp [OPTION]... [-T] SOURCE DEST

cp [OPTION]... SOURCE... DIRECTORY

cp [OPTION]... -t DIRECTORY SOURCE...

Related commands

824 questions
-1
votes
3 answers

bash script: how to cope with the different cp behaviors?

Among the tons of cp questions I have not found anything about this difference in behaviour (tested on Ubuntu 18.04). Sorry for the lost post, but the setting is a bit complex. Case 1: This is the expected behaviour Given the following folder …
CatMan
  • 173
  • 8
-1
votes
1 answer

Backup for a linux system via osx

I have an odroid (raspberry-like) machine with an arch linux system installed. Now I want to move the system from one microsd (A) to another microsd (B). When I tried this, the system became corrupted, information about files attributes were…
-1
votes
1 answer

Copy one file into multiple names

I want to copy one file into other names: cp server4.conf server{5..8}.conf cp: target 'server8.conf' is not a directory Why is this command not working?
peterge
  • 11
  • 3
-1
votes
2 answers

Why does the file in a subdirectory not get copied?

I have to make a script which will copy all files from a certain location starting with "db." to another location. My script works fine for all files which are directly in the directory, but it doesnt copy any files which are in subdirectorys. I…
Manuel
  • 17
  • 4
-1
votes
1 answer

Copy or move with combining source and destination path to avoid long path repeated

I need to edit many python files. When I about to start editing a file, I just create a copy of the file and will compare to this copy after I am finished editing and save changes to original file. So I tend to work from one fixed location/path and…
Arjun V
  • 1
  • 2
-1
votes
1 answer

impossible to evaluate dir while copying in loop

im executing this command : for i in `ls -lrt --full-time /tmp/source/ | grep "2018-11" | awk '{print $9}' `; do cp /tmp/source/$i* /tmp/data/; done but i'm getting this error : cp: impossible d'évaluer …
user1361815
  • 339
  • 2
  • 16
-1
votes
1 answer

Execute a linux command to copy pdf files in a text file to a directory

I have a list of pdf files in my text file called "pdf.txt".How to copy this to a directory /home/temporary using linux command. #!/bin/bash pdf=cat pdf.txt cp -R $pdf /home/temporary/b This is not working.
sobha
  • 165
  • 1
  • 9
-1
votes
1 answer

Why directory copied with cp command has less size than the original one

I am tying to copy one directory with big amount of files to another destination. I did cp -r src_dir another_destination/ Then I wanted to confirm that the size of the destination directory is the same as the original one: du -s src_dir 3782288…
Hirurg103
  • 4,783
  • 2
  • 34
  • 50
-1
votes
1 answer

How to copy files with the same name in different source dir and rename in destination dir?

I have a list of files in following structure: A/abc.zip B/abc.zip C/abc.zip I want to use copy command to copy them: $ cp */abc.zip ~/dest/ This seems to replace the file every time, how can I copy these files properly with Linux bash? Say if…
Pythoner
  • 5,265
  • 5
  • 33
  • 49
-1
votes
1 answer

Bash script to copy folder and contents without one file

I'm trying to copy a directories contents without one file. The problem i'm having is that the file is a few folders nested and the extglob operator fails to match. Assume the following folder structure: I would like to copy everything from…
Jarvis
  • 312
  • 3
  • 12
-1
votes
2 answers

Override copy files using -exec cp

mkdir zipFiles find . -name '*.zip' -exec cp {} zipFiles/ \; Error: cp: ‘./zipFiles/status.zip’ and ‘zipFiles/status.zip’ are the same file I tried these commands to force copy to override the existing files, but none of them works; find . -name…
itgeek
  • 549
  • 1
  • 15
  • 33
-1
votes
1 answer

CP Script Messing Up File Names

I'm SSHing onto a server to run a script that contains about 250,000 lines like the following: cp directory_a/file_1.jpg new_directory/file_1.jpg cp directory_b/file_2.jpg new_directory/file_2.jpg Each file name is unique. Some of the names of the…
Ezra-Shimon
  • 35
  • 2
  • 7
-1
votes
1 answer

Transferring big files with cp command in terminal and see want to see process

I used the "cp" command to copy and paste a big directory (>300GB) to an external disk. Now i want to see the process because it is running for almost 12 hours. I pressed ctrl + t because someone else recommended it. And the output was: load:…
johannesha
  • 23
  • 1
  • 3
-1
votes
1 answer

Rpmbuild copying folders specified by a mapping file

Currently, working with rhel. Need to create a script that can use a mapping file (source and target need to be dynamic). What file type should be used for the mapping file (.csv, .txt, .json)? End directory in a slash e.g. src/ -r can be used…
phil o.O
  • 406
  • 2
  • 4
  • 20
-1
votes
1 answer

cp: cannot stat 'grandchildren': No such file or directory

I am attempting to copy and rename the grandchildren dir to the parents dir and it is giving me this error repeatedly: brad@brad-Inspiron-5558: ~/cli-tmp/parents/children/grandchildren$ cp -r grandchildren ../nephews cp: cannot stat…