Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

Questions tagged [cp]

cp is the command of the Unix operating system that is used to copy files.

0
votes
0answers
18 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
2answers
37 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
0answers
32 views

preserve access permission when copying from network share osx

I'm trying to make a script that copies files/folder from a network shared folder( in ActiveDirectory) to a high seirra 10.13.3 in shared folder on network, I have a folder called folder1 and script ...
0
votes
0answers
99 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
2answers
41 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
0answers
40 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).?
1
vote
0answers
234 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 ...
0
votes
0answers
147 views

How to preserve file mode attributes with cygwin cp command on Windows 10?

The same cygwin version 1.5.25 is installed on Windows 7 and Windows 10. With a perl script using the stat command, I see the source file mode is 666. The source file is a simple text file. After ...
2
votes
2answers
540 views

Are cp/rsync asynchronous?

We're running a backup script which first copies a file to a destination and then runs tar over it. DIR2BCK='/foo/bar' TMPDIR=$(mktemp -d) rsync -a ${DIR2BCK} ${TMPDIR}/ > /dev/null 2>&1 ...
1
vote
0answers
50 views

Copying LibreOffice from DMG to local SSD takes 35 minutes - cp takes 3 minutes

Today I downloaded the latest version of LibreOffice for my Mac. After downloading, I opened the DMG file and copied the app-folder to the Applications. This took 35 minutes for a 700 MB folder. At ...
0
votes
1answer
605 views

Fastest way to duplicate or copy or back up a directory with TB of data (image files) in it

Hi can you suggest an very efficient and high performance option to copy files (TB of data in the form of images are present) from one disk to another. I saw options like cp, rsync etc., but would ...
1
vote
1answer
169 views

several cp -r xxx . & are overwriting themselves

I have launched several: cp -r folder1 /home/USBkey/. & cp -r folder2 /home/USBkey/. & cp -r folder3 /home/USBkey/. & Each folder contains mp3 files. At the end of all copies, when I ...
0
votes
0answers
47 views

cygwin in windows10-transfer file from cygwin to win10 desktop?

I wish to send a file in cygwin user directory (/home) to windows10 desktop so that I might attach it to an email from my win10 system. What would the command line need to be? I have tried 'cp a.f C:\...
0
votes
0answers
576 views

How to copy symbolic links with relative path in Unix?

I have this folder /full/path/sourceFolder with the following files: full/path/sourceFolder/fileA /full/path/sourceFolder/copyA -> fileA /full/path/sourceFolder/copyB You can see that the symlink ...
0
votes
1answer
93 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 ...
1
vote
1answer
352 views

Linux - Will the CP command overwrite an open file

I would like to know if I use the CP or MV command as root to copy a file to a new directory, which already contains that file and is currently open by another user, then would the operation succeed ...
0
votes
2answers
122 views

Copy files from Column1 in CSV to target folder name in Column2 in CSV (Linux) [duplicate]

I have a CSV with two columns. Column 1 are full file names. Column two are folder names. I need to copy the file in column 1 into the folder in column 2. Both files and folders are in the same ...
3
votes
1answer
459 views

Optimal Linux copy command for large number of files

This is a topic I have not been able to find a definitive answer on, or at least one with a good explanation on why one solution is better than the other. Lets say I have two local drives, one with ...
1
vote
2answers
3k views

How do I SCP from remote machine to local machine?

I know there are some similar questions has been asked here and I did read them... however, I still can not copy a file from a remote machine down to my local computer... I am keep getting error like "...
1
vote
1answer
253 views

Using md5sum and date to update files with cp

I use cp -up --backup=t to copy files from my computer to the cloud and reverse, but sometimes the date changes for a few minutes (or I guess even seconds, as I see the same file date stamp) as I ...
0
votes
0answers
84 views

Bios flashing : copying exe to bootable external hd (cannot create regular file, read only filesystem)

I want to flash my bios so I can reset it with HP super+b boot bios reset. I downloaded the .exe flash. I created a Windows PE iso and burned it on a external HD that I will boot on, using the 'dd' ...
0
votes
1answer
2k views

Copy Files From Flash Drive To Ubuntu

I am attempting to copy files from my flash drive to my local drive on Ubuntu. This is the command that I ran sudo cp -i /media/owner/ESD-USB/mysql /var/lib/ But that output a message of - and the ...
2
votes
1answer
468 views

cp only files, skipping directories

Using cp to copy files from a directory that has an empty directory in it as well results in error return value, which fails my script. Is there a way for it to just skip the directories without ...
1
vote
1answer
165 views

Copying files while SSHed onto a computer

I am trying to upload some website files to a computer I am SSHed into and I'm not sure the correct command to use. I've tried looking up the cp command instructions but I can't work out what to put ...
1
vote
1answer
47 views

How to copy file only if file sizes between src/dst differ?

I wish to perform a file copy like: cp --verbose /srcfile /dstfile But I only wish to perform the copy if dstfile does not exist or if the dstfile filesize differ from the filesize of srcfile. How ...
1
vote
1answer
101 views

Replace multiple files recursively

I have a file structure like this: experiment/ ├── foo.txt ├── source-foo.txt └── subdir └── foo.txt I want to take the file source-foo.txt and replace the other foos with it. Just like doing cp ...
2
votes
1answer
76 views

Terminal: cp -r with directories with same name and different case

I'm trying to copy around ~250Gb from one drive to another. Catch is that the destination drive is formatted in NTFS or FAT or something and isn't case-sensitive, and I've got folders I need to copy ...
0
votes
0answers
44 views

Grub won't recognise USB stick

I am trying to boot to a USB stick using this guide. But unfortunately Grub won't recognise my usb stick when I type root ([tab], 0). Is there any way to solve this issue? I've tried copying the files ...
4
votes
2answers
816 views

How do you copy directories in Linux in these situations using cp?

Situation 1 How do I copy /home/src/somedir to /dest/ such that the path always ends up as /dest/somedir, regardless of whether /dest/somedir already exists? I want to avoid ending up with /dest/...
0
votes
1answer
2k views

missing destination file operand when cp

i tried to use the Linux alias: rm='cp $* ~/dustbin; rm $*' but it reported 'missing destination file operand after ~/dustbin' , why didn't cp recognize ~/dustbin as destination ?
1
vote
0answers
70 views

cp -r is copying over files that don't exist

I'm trying to copy the contents of one directory to another using: cp -r ~/dev/testing/app/ ~/dev/app/ It works, but it's copying over files that don't exist (at least visually). For instance ...
0
votes
2answers
64 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
1answer
25 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 ...
2
votes
3answers
13k views

how to copy a directory (folder and its contents) to another directory?

Here is my file structure: - someDirA - folderOne - folderTwo - somefile.txt - someotherfile.txt - someDirB - somefolder What I want 'someDirB' to look like: - someDirB - ...
1
vote
0answers
66 views

Ubuntu file copy fake success?

I am using Ubuntu 14.04. When copying a big folder with lots of files and sub folders from my NTFS U disk to my hard drive, the progress bar indicates that copy is finished. But the destination ...
0
votes
1answer
60 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 ...
1
vote
1answer
108 views

Keyboard command in shell for skipping file during copy

Probably a stretch but is there a keyboard command that is accepted by cp from the shell (using bash/zsh) to skip a currently copying file for example if I am recursively copying a folder structure of ...
0
votes
0answers
339 views

Linux cp command: Auto-rename files, windows-like, FAT32, file name restrictions, ignore symbolic links

Linux cp command: How can I auto-rename all files to conform to windows or FAT32 formatted device file name restrictions, and ignore all symbolic links? I am trying to copy the contents of my dropbox ...
1
vote
2answers
4k views

OS X - copy files issue - Resource busy

Calling all OS X experts. I copied two 1Tb drives (ex-Windows) onto a new 2Tb USB 3.0 drive using Finder on the Mac (OS X 10.9). The 2Tb drive is now about 90% full. I now want to duplicate that ...
2
votes
2answers
3k views

Linux cp command is not silent

I know with a -f cp should be silent but it's not! I do cp -rf Functional Functionalssssssss and if Functional does not exist, it says cannot stat 'Functional'... but I just don't want to see the ...
7
votes
2answers
5k views

Rsync copying current directory with name

I want to copy current directory to my backup directory: I tried this command rsync -a . ~/backup/ but it just copies the current directory contents instead of creating new directory at the ...
1
vote
0answers
491 views

cp: cannot stat error - when filename has Asian characters

I am simply trying to copy files using cp -r /home/user/source/ /home/user/destination/ but it throws me the cp: cannot stat /source/filename.xxx error for some of the files. When I searched for this ...
0
votes
1answer
2k 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
0answers
62 views

how to update a directory that is a mirror of another one (with hard-links)?

I like using cp -rl dir1 dir2 to make a recursive copy of dir1 into dir2 (using hard links to save storage, and usually followed by rsync to make progressive backups). The issue is that, if dir2 ...
1
vote
1answer
3k views

In Linux copy file and overwrite only if target is older [duplicate]

How in Linux using cp one can copy file to destination, but if destination exists, then overwrite only if destination is older than source? cp -f always overwrites, but overwrite is needed only if ...
-2
votes
2answers
198 views

Copy sequential files into sequential directories

I need to copy multiple, sequential files into sequential directories. The files have the julian date (day of year) with other info in the file name. The directories are listed by julian date (day of ...
0
votes
1answer
631 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\) ../...
3
votes
2answers
1k views

Wildcard not working in cp command when using exec

I want to copy all the files in all the directories to the parent directory, but I get the error ./img/* is not a directory For example. Here is the command that I used. Is there a better way to do ...
0
votes
1answer
318 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
1answer
8k 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: [root@xxx.xx....