Questions tagged [cp]
cp is the command of the Unix operating system that is used to copy files.
218
questions
0
votes
1
answer
2k
views
How to cp multiple file extensions?
How do I cp multiple file extensions, like png, jpg and tif files? I tried:
$cp ./*.(jpg|png|tif) ../output/
>bash: syntax error near unexpected token `(`
$cp ./01_reliefs/*.\(jpg\|png\|tif\) ../...
0
votes
1
answer
238
views
How to copy a list files to a list of directories or subdirectories
I'm trying to figure out how to copy a list of files to a list of subdirectories.
eg. I have 300 files to copy into 300 subdirectories - 1 to 1.
file1 -> dir1/sub
file2 -> dir2/sub
file3 -...
0
votes
1
answer
1k
views
cp all files in the same directory, but exclude subdirectories/files
I'm looking for a way to do something like this:
cp -R jquery-ui-1.10.3/themes/base/minified ui
..but to let it match all files in the minified folder (and only it's root) and except all ...
0
votes
1
answer
339
views
modify cp to copy to current directory if nothing else is specified
Can I modify cp so that it copies to the current directory if I don't specify a destination?
I want this command $ cp ../launcher.sh . to be equivalent to $ cp ../launcher.sh. Is this modification ...
0
votes
1
answer
680
views
Copy matches of recursive search to a new location
I want to search a directory recursively and copy all XML files to a new location. I can identify the files with:
ls -R | grep .xml$
or with full paths with:
find . -name \*.xml
Results of normal ...
0
votes
1
answer
11k
views
cp: cannot stat : No such file or directory
I am getting an error when I try to copy a file from my local computer to a remote server. I get the same error whether I use cp or scp.
Here is my input at the resulting error:
[[email protected]....
0
votes
1
answer
184
views
Copy specific subfolders on linux
I have similar file sturecture:
/home/dave/documents/static/
/home/static/
/home/dave/pictures/static/
/home/dave/otherfolders/
...
I want to copy from this directory only folders named static. ...
0
votes
1
answer
1k
views
can not copy big file to usb device
I mount usb device like this:
sudo mount /dev/sdb1 /media/usb
and then copy a big file which about 1Gb to the device:
sudo cp ~/big_file /media/usb
Ordinary, if I copy a big file to usb, the ...
0
votes
2
answers
589
views
How can I copy a directories contents alone?
I want to copy the contents of ~/old contents to ~/new without the ~/old directory itself
However when I do
cd ~/new
cp ../old ~/new
or
cd ~
cp -vr ~/old ~/new
or
cp -vr ~/old/ ~/new/
the /old ...
0
votes
2
answers
3k
views
rtorrent copy after download
so I`m trying to do the following:
When rtorrent finishes download, it should copy files from download dir to another dir called uploads, so the file would be in Downloads dir AND in Uploads dir.
...
0
votes
1
answer
1k
views
cp linux command options
how i do i copy all files from dir to another dir and escape file already exist and not overwrite it , using cp command under linux centos
0
votes
1
answer
209
views
Moving only the contents of a map and not the map itself on linux
Using the cp command, one can move files and folders on linux.
I want to make a new user and move the contents of the skeleton map to their home directory.
I use this command:
cp -r /etc/skel/ /...
0
votes
2
answers
289
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 ...
0
votes
1
answer
413
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
918
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
245
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
1
answer
294
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 ...
0
votes
1
answer
78
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 ...
0
votes
1
answer
4k
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
2
answers
2k
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
2
answers
144
views
Reference cells in column of .csv from command line
I have a column B in my.csv in which each cell references the filename of a document in a directory source_directory/.
I'd like to grab each of those names so I can use them as args for other shell ...
0
votes
1
answer
66
views
Zsh: prepend $(<list.txt) args with a directory
I'm using cp $(<list.txt) new_folder to copy a list of files (filenames in list.txt) to a new folder. As is the files must be in the same folder as list.txt.
Is there an easy way to make this work ...
0
votes
1
answer
4k
views
Linux Bash: Moving/Copying files/directories by timestamp
This is the command I am using:
find absolute-path -name "*" -amin -120 -exec cp -f absolute-destination {} \;
I’m trying to copy a lot of directories from a directory to another directory, but only ...
0
votes
1
answer
593
views
Mac mv command very slow
On my mac cp command works 9 times faster then mv.
Why it is possible?
Mac-Pro-AVM-4:2014-10-22 editor$ time cp /Volumes/AVM4_HD5/INGEST/Final\ Cut\ Original\ Media/2014-10-22/Clip\ \#13.mov /Volumes/...
0
votes
1
answer
1k
views
cp: fts_open: No such file or directory / Why?
I have following bash script:
#!/bin/bash
echo "This script will copy all JPG files inside directory '~/temp/merged':";
pwd;
read -r -p "Please confirm, that you want to copy all JPG files [y/N]" ...
0
votes
1
answer
529
views
Can I fork a copy command on ReadyNAS SSH?
I have a ReadyNAS 102 with a couple of USB drives attached, and connecting to it from a Windows 8 machine over SSH. There were times I wanted to copy files between volumes on the NAS. Unfortunately I ...
0
votes
5
answers
15k
views
Moving a file using PuTTY
I am newbie struggling to move a file on a Linux VPS using PuTTY.
I can log in with a user in PuTTY at this point I can navigate to see the file I wish to move (~/servers/apache-solr-3.6.2/example/...
0
votes
1
answer
799
views
cp - copying and keeping different version
How to copy all .aze files that have different contents into folder3 ?
The screen show what I don't want to do.
What I want to get close is to have in folder 3, file1(1).aze and file1(2).aze (and ...
0
votes
2
answers
7k
views
Why does my Bash script display the "too many arguments" error at the cp command?
Here is my script, I get the error "line 33: [: too many arguments", I'm confused why, surely only 2 arguments are being provided to cp here?
I am providing two directories to the script with no ...
0
votes
1
answer
398
views
Using find command with recursive copy without -r or a while/for loop
I have the following problem. Normally one would use the command find exec cp -r to copy everything from one directory to another. In this case I am not allowed to do so, or use a while/for loop for ...
0
votes
2
answers
2k
views
xargs and cp: find-style "{}+" multiple expansion?
I'd like to copy a group of files to destination folder. But without needing to spawn a new instance of cp for each operation.
The arg format for cp seems to be:
cp src_file1 src_file2 src_file3 ...
0
votes
1
answer
15k
views
Can't create directory, "permission denied" error
I am executing the following command from my Linux machine.
cp -r hwweb-ws-5.0 /home/tomcat/hwweb-1/webapps/
It's displaying the following error:
cp: cannot create directory `/home/tomcat/hwweb-1/...
0
votes
2
answers
2k
views
cp command can't find some directories
I'm trying to copy a bunch of files/directories using a terminal command, cp. The command I'm using is:
sudo cp -r *.tests ~/Desktop
tests are directories with stuff in them. However I get a few ...
0
votes
1
answer
4k
views
How to copy files and directories while retaining file permissions in UNIX
How can I copy files and directories from one user to another user on a unix system so that the file permissions don't change? The recipient is not the owner, but I have root permissions.
Thanks.
0
votes
0
answers
75
views
How to emulate rsync into cp to copy all files from source that dont exist in destination disk and update existing ones?
Rsync is halting when reading bad sectors, then the hdd is going in a very bad mode than needs special rescue. It is the 3rd time that this happens to my disks. The disk was very functional except for ...
0
votes
0
answers
89
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
271
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
4k
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
987
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, ...
0
votes
1
answer
2k
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
444
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
2k
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
0
answers
764
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
201
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
511
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
...
0
votes
1
answer
72
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 ...
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
393
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
328
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
0
answers
4k
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):
#: ...