Questions tagged [cp]

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

Filter by
Sorted by
Tagged with
1
vote
0answers
15 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
0answers
17 views

cp -p don't preserve modification time on Mac os on an exfat external drive

Do I need to give more options to cp? Rsync -a is able to preserve it Do you see the same behavior?
0
votes
0answers
19 views

Validate Simple Input and Output of a program on terminal

I do competitive programming so I need to check certain output for certain input. For which what I do is I compile my program with g++ file.cpp and than I paste input values in a new file called in....
0
votes
1answer
13 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
89 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
34 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
83 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
36 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
70 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
0answers
24 views

Would this tar command overwrite existing data?

So, I think the answer to this is no, however, I am still paranoid about my data - and just want confirmation from someone who is smarter than I. In my quest to copy a directory to another directory ...
0
votes
0answers
31 views

How to transfer the creation date of a file with rsync or similar on MacOS

Actually rsync is not able to manage the copy of creation time. Although you use the -a (which includes -t) and -E flags, it still copies all metadata, but in terms of dates it copies only last modify ...
0
votes
2answers
53 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
167 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
386 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
0answers
22 views

How to overwrite files and preserve TARGET attributes?

I'd like to overwrite files in a way that preserves the TARGET ownership and permissions. It seems like something cp should do, but cp --preserve=... refers to the SOURCE attributes, not the TARGET ...
0
votes
1answer
56 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
47 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
468 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
475 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
50 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
217 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 » -&...
0
votes
1answer
3k 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
1k 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): #: ...
18
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
50 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
49 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 ...
6
votes
1answer
3k 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
23 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
289 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
302 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
397 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
59 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 ...
1
vote
0answers
456 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
2k 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
106 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 ...
0
votes
0answers
186 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:\...
1
vote
0answers
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
157 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
734 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
404 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
830 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 ...
2
votes
2answers
12k 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
550 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
95 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
5k 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
4k 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
277 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