Questions tagged [cp]
cp is the command of the Unix operating system that is used to copy files.
217
questions
0
votes
0
answers
23
views
cp -nv - how can I only print copied files without the "skipping ..." messages?
I'm often using cp -nv. The newest version also prints messages like
skipped some/file.txt
for all files already existing on the target between listing the files that are actually copied. In this vast ...
0
votes
0
answers
165
views
Why is midnight commander able to copy files so much faster than cp?
I discovered an interesting behavior of mc. When I copy files across devices (at least those that are smaller than free RAM) it seems that the copy is using writeback cache and is nearly instant (on ...
1
vote
1
answer
36
views
LINUX cp -r with attributes (sepecially icon)
LINUX Mint 20.04 I need this for a script that already has worked in UBUNTU but doesn't anymore in Mint.
My problem: I have a directory for which I have changed the icon by simply right-clicking on it ...
3
votes
1
answer
98
views
File dates copied with "cp -p" are set to "now"
I'm using my Mac to try to copy the content of a smartphone's SD card to a larger card. Because I don't want all the pictures to get new creation dates I used the --preserve option like this:
cp -pr /...
0
votes
2
answers
196
views
How to copy files into specific offset of a harddisk?
Source harddisk: Size 500G. 210G of data. Used hexdump to check beyond 280G are all zeroes.
hexdump -C /dev/sdd2 --skip 280G --length 10G # all zeroes
Destination harddisk: Size 600G. Used hexdump ...
1
vote
2
answers
91
views
linux cp current directory level only
I have a dir that contains files and subdirs. I want to copy files in the dirs only, so I run
cp -v src/* dst/
and get error cp: -r not specified; omitting directory. I'd be ok to ignore it but the ...
1
vote
1
answer
25
views
copying a directory and changing the filenames within
I'm trying to write a script that will copy the contents of one directory, send them to ./test/ and append _copy to the file name. Below is my current script. I seem to be unable to append _copy to ...
0
votes
0
answers
169
views
Getting No Data Available when using cp to copy a file (but file exists)
I am trying to copy a file with cp in Linux, and am getting an error: No Data Available
The file exists in my FS:
> ll formation_xrpu_personnalisation_27-09-2021\ 15\:33\:43.webm.mov
-rw-rw-r-- 1 ...
0
votes
1
answer
3k
views
Operation not permitted error
I'm trying to copy a file in which i'm facing below error.
$ cp encryptionkey.img ~/Desktop/
cp: cannot open 'encryptionkey.img' for reading: Operation not permitted.
I do't know why cp is not ...
0
votes
1
answer
121
views
rsync file duplication ignore is not working as expected
I am confused with the working of rsync. Here is what I did and expected.
I created two folders named 'sbck' and 'dbck'.
Scenario 1:
I created a file named a.txt and created a copy of it using cp -rp ...
0
votes
1
answer
421
views
rsync from MacOS to Ubuntu?
I'm trying to rsync some files from my macbook to an ubuntu laptop ( [email protected] ) using this command:
rsync -vazh ~/Folder [email protected]
But instead of syncing the files to the remote host, ...
10
votes
1
answer
1k
views
cp --backup=CTRL, why nil and never?
https://linux.die.net/man/1/cp
The backup suffix is '~', unless set with --suffix or SIMPLE_BACKUP_SUFFIX. The version control method may be selected via the --backup option or through the ...
0
votes
1
answer
630
views
Copy / restore files from Time Machine Backup Volume without Permission Denied Error
On new MacBooks (Big Sur, 11.2.3, M1) disk space is costly, because there is no alternative to apple parts. So i have NOT used Migration Assistant, to copy over all the old files from Time Machine ...
0
votes
1
answer
1k
views
Why Linux 'cp' command did not copy files from soft link completely?
I have a soft link which linked to a nested image folders (thousand of images)
(DRS) xzhan@4daf823ea86f:~$ ls -l voc12_root
lrwxrwxrwx 1 xzhan aiml 30 Mar 16 15:20 voc12_root -> /mnt/Data/Datasets/...
0
votes
1
answer
363
views
How to copy files that match elements on a list?
Imagine I have many files whose names are of the form file#.tex
9that is, file1.tex, file2.tex, ..., file100.tex). I need to copy only those files whose number # is in another file named chosen.txt ...
0
votes
2
answers
1k
views
Best method (mv/cp) to replace an active file in linux?
I am making a script for updating a text include/conf file for an active service. The script will first write changes to a temp file. When done, to replace the include file with the temp file, ...
0
votes
1
answer
118
views
Copy relative links to absolute links
Given a directory /path/to/files that contains many relative links along the lines of foo -> ../other/data/foo, how do I copy the links in files/ to be absolute path links on /mydata/path/
I ...
0
votes
0
answers
453
views
MKDIR command saying file doesn't exist, even though it does
When I try to make a directory or copy a file onto my Windows 10 partition, I get this error:
mkdir /mnt/Windows/Test
mkdir: cannot create directory ‘Test’: No such file or directory
Even though the ...
0
votes
1
answer
181
views
Copy interrupted and difficulties to take it over by relaunch with cp -u or rsync
I have a huge data to transfer between 2 macOS (1.3 TB).
Unfortunately, my copy from mac1 to mac2 (by mounting the concerned directory of mac1 on mac2 as network directory), the copy with 'rsync' (...
0
votes
1
answer
256
views
How to copy symlinks to a device that does not support symlinks?
I am trying to backup a directory to a Samba share, which apparently does not support symlinks.
Are there any good solutions of how to proceed?
I would suggest a sensible behaviour might be to
...
2
votes
2
answers
276
views
Why Can't I copy a folder to a disk that is larger than my folder?
I am using ubuntu 18.04-4 and want to move a large directory (yocto build directory for my project) from my ~/Desktop to an external drive (ext4 formatted). The external drive is a 512 GB empty drive. ...
0
votes
1
answer
51
views
Can someone tell me why my laptop's showing such high temps? I'm unable to run most of the things i could run before
screenshot of task manager sorted by cu usagehttps://i.stack.imgur.com/xtS4t.jpg video of ask manager processes
my temperatures reach upto a 100 degree celsius sometimes.Most of the time they're at 80 ...
1
vote
0
answers
66
views
cp files from directories but abandon directory structure [closed]
As an example, I have this directory structure:
src
|- a
\- 1
|- b
\- 2
|- c
\- 3
I want to copy 1, 2, 3 to something like this:
dest
|- 1
|- 2
|- 3
My idea is to write a bash script that ...
0
votes
1
answer
241
views
Why does xargs with cp fail for recursion?
I am trying to copy files from one directory into a whole collection of other directories, such that the set of files in the source directory will be present in every one of the destination ...
1
vote
1
answer
4k
views
Permission denied when directly copying from SSHFS to SD
I have a remote hard disk mounted with sshfs on a local mountpoint. Furthermore, I have mounted an SD card to the same computer. When I try to copy from the remote disk to the SD card the permission ...
2
votes
0
answers
46
views
Copy symbolic link and its target subdir to new dir
I have a dir with a symbolic-linked subdirectory:
greg:/testA> ls
foo -> alice
alice/
I need to copy the link "foo-> alice" (preserve it at destination) AND the subdirectory alice/ to a new ...
3
votes
2
answers
8k
views
Best way to compare two very large directories in Linux
I need to compare two directories on Linux filesystems on two separate servers in order to identify whether all the files from SERVER1 are present on SERVER2. The total data set is about 4TB of files ...
0
votes
1
answer
68
views
The -r flag for directories seems to be useless now [closed]
cp, scp, rm and other command needs to the -r flag to perform an action on a directory, compared to just a file.
can't copy a directory because WHOOPS you forgot the -r flag
I don't feel this is ...
1
vote
1
answer
2k
views
Copy single dotfile from a folder to another on local machine
Before you downvote, I have read the following solutions:
How do I copy file named starting with a dot?
How to copy with cp to include hidden files and hidden directories and their contents?
Linux / ...
0
votes
2
answers
796
views
Copy file to multiple folders using brace expansion
I'm trying to copy a file from a folder into multiple folders using brace expansion like this:
cp source_folder/source.json target_folder{1..11}
But I get this error (for each target_folder name:
...
0
votes
1
answer
3k
views
Selectively uploading multiple folders to AWS S3 using CLI
I have around 50 folders, which contain subfolders, I want to upload the folders and subfolders to an S3 bucket, while keeping the subfolders structure.
I read I can use --include command multiple ...
0
votes
1
answer
2k
views
pscp "Cannot open file"
I am trying to deploy the files in my web application to the server using the pscp tool. It works for all the files in the directory, except sqlite (.db) file.
For the sqlite file, it throws this ...
0
votes
1
answer
330
views
How to copy files from damaged HDD , skip individual files if takes too long in linux
I had a damaged HDD with very high value of Raw_Read_Error_Rate (50k!) but 0 for Reallocated_Sector_Ct , Reallocated_Event_Count, UDMA_CRC_Error_Count.
I have a directory with >1000 files that I want ...
0
votes
1
answer
285
views
copy all files with jpg/jpeg extension in specific sub categories to single directory
I have a directory structure as below
product_images
product1
LR
low res images here
HR
high res images here
product2
LR
low res images here
HR
high res images here
product3
LR
low res ...
0
votes
2
answers
3k
views
how can I get the yes command to force overwrite and to do so with new lines?
I would like cp to prompt before overwriting so I am using -i.
(I might sometimes use an alias for cp, or similar, so cp always occurs with -i).
I may want to say overwrite all. I know that's the ...
1
vote
0
answers
2k
views
Why is the `cp` command giving me "will not create hard link" messages when I never asked it to create links?
I recently ran the command cp --update --verbose -r ./* "E:\Backup m.d.y" and now I am seeing messages like this appear:
cp: will not create hard link `E:\Backup m.d.y/Python
Programs/...
0
votes
1
answer
654
views
How to force cp to writeback all the data before it finish?
It seems that cp in linux won't write back all the dirty memory to the disk by default. Is there any options to force cp writing back all the data before it finish?
2
votes
2
answers
1k
views
How to display filename only as an output of cp command?
I'm copying files from src folder to dest folder usign the command:
cp -nv /src/* /dest/ > copy_result.txt
The result of copied files is in the output file as shown below:
« /src/test1.txt » -&...
4
votes
1
answer
16k
views
Linux issues with cp: -r not specified; omitting directory
Can someone help me understand what that means?
cp: -r not specified; omitting directory
I am trying to use this command
sudo cp /home/$USER/Documents/myfile.10 /home
Error:
cp: -r not specified; ...
0
votes
0
answers
3k
views
'Device not configured' error with cp and rsync (NTFS volume on Mac)
I am trying to backup data from one external harddrive to another using cp and/or rsync on a Mac.
The external drives given by diskutil list are:
/dev/disk2 (external, physical):
#: ...
19
votes
2
answers
4k
views
Why is a directory copied with the cp command smaller than the original?
I am tying to copy one directory with a large number 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 ...
1
vote
0
answers
181
views
create date folder version backups with hard links and a combined view
I am using the ideas laid out in this article to create incremental versioned backups of my data. I basically sync the data to a current folder in my backup destination and then create a date folder ...
0
votes
1
answer
103
views
How to copy directory to destination that destination have same link name with source directory's name?
I have a problem. When i copy a folder to destination for that destination has link with source folder name, the link change to directory
$cd /home/srr7
$mkdir jetty_home123
$ln -s jetty_home123 ...
24
votes
2
answers
15k
views
Can I hard link files with rsync instead of copying them?
cp -l hard links files instead of copying them, saving filesystem space. I need to use rsync instead of cp because of its --exclude capabilities.
So my question is, how do I get rsync to hard link ...
0
votes
0
answers
224
views
Copy directory but not recurse
I want to copy a directory without recursing, preserving "everything", sort of like cp -a except that -a will do the unwanted recursing.
The reason is I am making a script to copy/backup from an ...
0
votes
2
answers
718
views
Cant copy a file in Linux: cp: target '/.local/lib/python3.6/site-packages/certifi' is not a directory
I am using Ubuntu 18. I want to copy two files in a directory from the desktop to the following directory: home/me/.local/lib/python3.6/site-packages/certifi
I executed this command:
~/Desktop$ sudo ...
0
votes
0
answers
420
views
How to copy the packages from CentOS iso image?
Objective:
To copy packages to hard disk from CentOS iso image on CentOS 7
Procedure Followed:
mkdir /home/ava/linux
mount -o loop -t iso9660 /media/sdb1/CentOS-7-x86_64-Everything-1708.iso /home/...
0
votes
2
answers
1k
views
cp -av Doubling directory
cp -av /home/jake/transit/scalaProjects/scalaML/src/main/scala /home/jake/project/__workspace/scalaProjects/scalaML/src/main/scala
cp -av /home/jake/transit/scalaProjects/scalaML/src/test/scala /...
0
votes
0
answers
462
views
Use `cp src/* des/` suppressing warning when encountering folders
How can I use cp src/* des/ for copying all files which are not directories and without receiving the warning
cp: <my_dir> is a directory (not copied).?
2
votes
1
answer
2k
views
Mac High Sierra cp command returns "Result too large"
Having a devil of a time figuring this out. I've got the latest MacOSX (10.13.2). I am trying to copy a file to an external drive for my backups. Ran into an error where cp returns "Result too ...