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
1 answer
18 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 ...
user avatar
0 votes
1 answer
11 views

rsync from MacOS to Ubuntu?

I'm trying to rsync some files from my macbook to an ubuntu laptop ( ole@192.168.9.36 ) using this command: rsync -vazh ~/Folder ole@192.168.9.36 But instead of syncing the files to the remote host, ...
user avatar
  • 165
10 votes
1 answer
989 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 ...
user avatar
  • 481
0 votes
1 answer
191 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 ...
user avatar
  • 111
0 votes
1 answer
130 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/...
user avatar
0 votes
1 answer
31 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 ...
user avatar
  • 103
0 votes
2 answers
156 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, ...
user avatar
0 votes
1 answer
32 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 ...
user avatar
  • 113
0 votes
0 answers
61 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 ...
user avatar
0 votes
1 answer
84 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' (...
user avatar
0 votes
1 answer
27 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 ...
user avatar
  • 1,957
2 votes
2 answers
156 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. ...
user avatar
0 votes
1 answer
42 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 ...
user avatar
1 vote
0 answers
37 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 ...
user avatar
  • 11
0 votes
1 answer
82 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 ...
user avatar
  • 656
0 votes
1 answer
2k 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 ...
user avatar
  • 278
2 votes
0 answers
42 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 ...
user avatar
2 votes
2 answers
2k 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 ...
user avatar
0 votes
1 answer
42 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 ...
user avatar
0 votes
1 answer
758 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 / ...
user avatar
0 votes
2 answers
392 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: ...
user avatar
0 votes
1 answer
2k 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 ...
user avatar
  • 157
0 votes
1 answer
1k 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 ...
user avatar
0 votes
1 answer
198 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 ...
user avatar
0 votes
1 answer
70 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 ...
user avatar
0 votes
2 answers
2k 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 ...
user avatar
  • 21.8k
0 votes
0 answers
1k 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/...
user avatar
  • 327
0 votes
1 answer
173 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?
user avatar
0 votes
2 answers
931 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 » -&...
user avatar
3 votes
1 answer
10k 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; ...
user avatar
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): #: ...
user avatar
  • 111
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 ...
user avatar
  • 313
1 vote
0 answers
109 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 ...
user avatar
0 votes
1 answer
68 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 ...
user avatar
  • 1
18 votes
2 answers
9k 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 ...
user avatar
  • 1,169
0 votes
0 answers
38 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 ...
user avatar
0 votes
2 answers
609 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 ...
user avatar
  • 1,037
0 votes
0 answers
352 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/...
user avatar
  • 113
0 votes
2 answers
920 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 /...
user avatar
  • 117
0 votes
0 answers
138 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).?
user avatar
  • 153
2 votes
1 answer
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 ...
user avatar
2 votes
0 answers
566 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 ...
user avatar
2 votes
2 answers
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 ...
user avatar
  • 5,411
2 votes
0 answers
146 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 ...
user avatar
  • 6,690
0 votes
1 answer
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 ...
user avatar
1 vote
1 answer
491 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 ...
user avatar
  • 13
1 vote
1 answer
3k 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 ...
user avatar
0 votes
1 answer
240 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 ...
user avatar
1 vote
1 answer
994 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 ...
user avatar
  • 125
0 votes
2 answers
502 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 ...
user avatar

1
2 3 4 5