Questions tagged [cp]

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

Filter by
Sorted by
Tagged with
0
votes
2answers
32 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
1answer
21 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
0answers
41 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
1answer
32 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
1answer
16 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
2answers
144 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
1answer
37 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://imgur.com/gallery/t3rCwJH video of ask manager processes my temperatures reach upto a 100 degree celsius sometimes.Most of the time they're at 80 ...
1
vote
0answers
28 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
1answer
32 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
1answer
1k 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
0answers
35 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 ...
1
vote
2answers
759 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
1answer
37 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
1answer
311 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
2answers
175 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
1answer
1k 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
1answer
865 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
1answer
67 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
1answer
53 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
1answer
1k 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 ...
0
votes
0answers
798 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
1answer
89 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?
0
votes
2answers
589 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 » -&...
3
votes
1answer
7k 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
0answers
2k 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
2answers
3k 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
0answers
80 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
1answer
58 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 ...
13
votes
2answers
6k 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
0answers
24 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
502 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
316 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
636 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
72 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
1answer
1k 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 ...
2
votes
0answers
499 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
3k 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 ...
2
votes
0answers
133 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
1k 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
458 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 ...
1
vote
1answer
2k 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
183 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
853 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
429 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
1k 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 ...
3
votes
2answers
16k 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
648 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
1answer
7k 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 ...
4
votes
2answers
7k 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
296 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
2 3 4 5