Questions relating to the Linux 'cp' command.

learn more… | top users | synonyms

1
vote
1answer
24 views

Can cp completely overwrite a directory?

I'm wondering if there is a way to completely overwrite a directory that is being copied to without first needing to erase it with the rm command, meaning I don’t want to have files remaining in the ...
1
vote
1answer
31 views

Copying files from directories having spaces in its name

This is what I tried. inputFile=$(zenity --file-selection --title "Test" --text "Please select the file for analysis." | sed -e "s/ /\\\ /g") I did the sed operation to replace white spaces with a ...
4
votes
4answers
1k views

What is the difference between scp and cp?

I'm really new to the command line and Ubuntu and I have recently learned that there is the scp command as well as the cp command. I tried to use an scp command to move a directory from Point A to ...
1
vote
2answers
57 views

cp & mv commands are not working

When I try to copy a file cp testfile.txt sampledir It keeps saying cp: invalid option -- '1' Try 'cp --help' for more information. This is for any file I try to copy. When I type 'cp --help' ...
1
vote
1answer
322 views

getting razercfg to work using systemd - systemctl: command not found

My goal is to change my mouse DPI. So any less frustrating solution is also welcome. I'm trying to get this program to work and i'm following it's README file: ...
0
votes
0answers
30 views

Problem copying files

While copying a file it gets stuck at the end. For example while copying a file of 1.8 gb, 1.7 gb gets copied instantly, but then no progress.
1
vote
3answers
63 views

How can I mv files from another user to my Home folder (knowing the password of the other user)?

Suppose I am logged in as user A on a PC. On the same PC there is another user B. I want to move certain files from user's B home folder to A's home folder. Note that neither A nor B are sudo. ...
1
vote
0answers
17 views

Unable to play last tracks of mp3 cd

for some reason I am not able to play the last tracks of some mp3 cds (of a audiobook I purchased). I am able to play the first tracks of the CD. Therefore it couldn't be a problem with missing ...
0
votes
1answer
29 views

cp -p command in ubuntu

set series = usno if ( ! -e ut1.${series} ) \cp -p ~/gg/tables/ut1.${series} . I'm trying to grasp a script. I need to know that what cp -p command works in this script?
-1
votes
1answer
44 views

Copy one file to other of same name

I have 2 folders with same name (pepe pepe). i want to copy the files of pepe to other one without lossing the files of destination . how i can do it ? copying new files from pepe folder to other ...
1
vote
1answer
155 views

cp not copying files?

cp -v /var/www /var/www/dev cp -vR /var/www/admin /var/www/dev cp -vR /var/www/cron /var/www/dev cp -vR /var/www/css /var/www/dev cp -vR /var/www/files /var/www/dev cp -vR /var/www/images /var/www/dev ...
0
votes
1answer
89 views

How to copy and paste a file through the command-line? [duplicate]

I want to copy and paste a file to /usr folder but I guess I need root access to do so so I need to learn how to copy and paste a file from one location to another through the terminal.
1
vote
1answer
49 views

Why is this odd file extension appearing when I scp a file?

I'm creating a large number of gifs and copying them to a separate computer with a webserver folder mounted via sshfs. For some reason the files will randomly copy with *.gif.001 file extensions. My ...
2
votes
2answers
269 views

cp problems with copying root

I have a little bash script going to check if the system has been backed up today and and if it hasn't then it copies the entire filesystem into the backups folder: date=$(date +"%m%d%y") sudo mkdir ...
3
votes
2answers
59 views

Jpg images turn black on using cp command line

I have used the following command to copy folder containing JPEG and PNG images: sudo cp -r ~/Downloads/wallpap/ /usr/share/backgrounds/ However the JPEG images turn black while the PNG images are ...
1
vote
2answers
41 views

Why does cp not copy a specified folder

let's say that I have a following file structure: ~/DIR1 -fileA -DIR2 --fileB Then, being in ~, I run this script: cp DIR1 NEWDIR2 And just an error happens: cp: omitting directory ‘DIR1’ I ...
0
votes
2answers
104 views

Use of “cp” command between root user's home and plain root

How do I use the "cp" command to copy files from root@pcname:/home/username # to root@pcname:~ # I have been able to use the mv command to move a file, but when I use cp, it tells me that the ...
0
votes
1answer
93 views

Can not copy cisco packet tracer icon

$ cp PacketTracer.jpeg /usr/share/icons/ cp: cannot create regular file ‘/usr/share/icons/PacketTracer.jpeg’: Permission denied
2
votes
1answer
711 views

cp Cannot Stat '-r'

Strange issue, for some reason, when I'm running a copy command, it's treating the -r flag as an argument. sudo cp –r usr/* /usr The following is the error: cp: cannot stat ‘–r’: No such file or ...
1
vote
0answers
7 views

Portable hard drive - bad sectors blocks fails on backup [duplicate]

I have a 2TB portable hard drive from Western Digital that I have used over the years. I use it on my home server to for NFS streaming. I have noticed recently while streaming some content it fails ...
1
vote
1answer
27 views

Need to copy large directory structure, re-mounting and re-trying in case of I/O error

I have an external hard drive which works for several minutes at a time, and then un-mounts itself. I am trying to copy 300GB of data off of it. I'd like a program that works like Dolphin (the Kubuntu ...
1
vote
0answers
71 views

Resume cp that was interrupted

I was doing a huge cp command, copying 1TB and I had disconnected computer from network after 700GB. Files are still there but I can't anyhow to resume copying. I tried sudo rsync rsync ...
1
vote
2answers
78 views

cp command syntax difficulty

I have rescued many files from a failing hard disk. They are in 500 sub directories each containing 500 files. I am trying to copy all the files in all the folders into new subject directories (like ...
2
votes
2answers
2k views

force cp to copy on dangling symlinks

Is there any way to force cp (Bash 4.2.5, Ubuntu 12.04) to copy onto a dangling symlink? cp a-file path/to/danling/symlink/a-file cp: not writing through dangling symlink ...
-1
votes
1answer
78 views

Copying 100 files at a time using terminal [duplicate]

Is there an option to copy first 100 files from a directory to another location using the cp command? If not is there any other way to do this? Do i need to write a script?
0
votes
1answer
26 views

Sporadic problem making a directory in ntfs external drive

I have an NTFS formatted external drive that I use to back up my home directory and another directory called /virt which I use to store the files for a virtual box. Using rsync, I regularely back up ...
1
vote
1answer
37 views

using cp command without destination operand on large directory does not give error and uses up disk space

Bit of a strange one here I was trying to copy data from one directory to another and left off the destination operand from the cp. See command root@server:/home/pp/test1# cp -r ../dhcppc0/* The ...
0
votes
0answers
83 views

HTTP request using IPtables doesn't work for captive portal!

I am trying to make a simulation of a captive portal on 3 virtual machines (VM Ware) for my school project this week. Setup 1 = Ubuntu client 2 = Ubuntu server (router) 3 = Ubuntu server (captive ...
0
votes
1answer
65 views

How to copy and paste files with CLI and have a status [duplicate]

I am trying to copy large amounts of data using SSH so all I have is the CLI. I am using the cp -a /source/* /dest/ method but I can't tell how fast it is copying or what the progress is. Is there ...
1
vote
1answer
210 views

Why can I not copy file with cp -rf mydir/* …/mydir/.?

When I try to copy cp -rf mydir/* .../mydir/. I get next error: cp: cannot stat 'mydir/*': No such file or directory But there are files in this directory. Please help me to find out reason of it.
1
vote
2answers
237 views

“mv” versus “cp” in a bash script [closed]

I am attempting to make a script that will be able to load up some settings and files to a board. Basically I will plus a flash drive into the board click on the script. The script will then ...
1
vote
1answer
143 views

Copying files and folders with cp with shopt extglob - error is not a directory

I'm trying to copy files from a directory while excluding a folder and a file. My problem is that a get an error with shopt extglob activated. Here is my code: ...
2
votes
2answers
145 views

Error using “cp” to copy files to an external disk

I have a 2TB external HDD formatted with exFat that I use to share very large files (>10GB) among Ubuntu, Windows 7 and MacOS. I am trying to copy the whole content of a directory using sudo cp -r . ...
0
votes
1answer
63 views

cp command “loud” version

Is there any way, to make cp - command "loud"? Sometimes I want copy large file, or directory with many files. It is very useful, to see what cp is doing right now, which file, % of this file or % of ...
1
vote
2answers
129 views

What happens when you force quit a `mv` directory operation between two disks?

Another way to word the question is... What happens when you mv a directory between two disks? Does it move one file after the other, or does it copy all files to destination, then then delete ...
1
vote
2answers
12k views

cp fails to copy with errors “cp: error reading 'file': Input/output error” and "cp: failed to extend 'file': Input/output error

I'm a user of Oracle Virtualbox on Ubuntu. And I used to copy vdi files as a kind of backup. Previously I did this (copying vdi file and then copying it back) many times without any problem. But ...
6
votes
2answers
3k views

Undo copy (cp) command action

I copied some file from source folder into destination folder by using bellow command line in terminal. sudo cp From_SOURCE/* To_DESTINATION/ Now I want to undo this command.
1
vote
1answer
51 views

Looping in bash from Makefile

i need to write a Makefile that compiles each .cpp in current directory in .so file (with flags -shared -fPIC) and copyies .so file into "../../dir/" directory without ".so" extension. For example, ...
2
votes
1answer
10k views

What does “omitting directory” mean and how do I make it cp the directory rather than omit it

I am doing a data recovery for someone and enter the following command -Ubuntu:~# cp /media/Macintosh\ HD/Users/orlandocampoverde/Desktop\ (original)/VIDEOS\ ESPANOL/ /media/\$G\$\ ...
0
votes
1answer
97 views

Why doesn't 'cp /user/local' work?

I was trying to copy a directory to /user/bin (on Ubuntu 12.04). I tells me that I cannot create directory ``/user/local' No such file or directory`. Where did I make a mistake? sudo cp -r ...
0
votes
1answer
59 views

Copy several files

I have a list of files, and I want to generate several copies of them. The copies should be numbered. For example, I have the files: fileA, fileB, ..., fileC The first copy should generate the ...
6
votes
2answers
1k views

Using mv & cp on a headless server (SSH timeout interferring?)

I've recently set up a headless server to back up a number of very large film & editing files. I SSH into the server and - following some best practice guides I found around - I've tightened ...
3
votes
3answers
33k views

cp - cannot create regular file : permission denied

I want copy to /lib/udev but gives error cp -f /tmp/ok_pcscd_hotplug.sh /lib/udev cp:cannot create regular file /lib/udev/ok_pcscd_hotplug : Permission denied I am root , but I can't understand . ...
1
vote
1answer
361 views

how to copy directory with wildcard to another folder

i need to make a cron that copy folder on /home here is the content of my /home fina f-logistik folder-surat-jalan zone-A zone-B zone-C zone-free what i need to copy is only folder that start ...
0
votes
2answers
159 views

Can't find copied files

I used cp to copy files to a directory which didn't exist. I have no clue where they went to, and the worst part is it filled up my primary 120gb ssd so I can't make any changes to anything. Where ...
39
votes
7answers
19k views

How to copy a file to multiple folders using the command line?

I have tried to copy a file test.txt to multiple directories with one command: cp ~/test.txt ~/folder1 ~/folder2 But I didn't succeed. Is there a way to do that in one command so I can copy a file ...
1
vote
2answers
179 views

Recursively copying files

How can I copy *.txt files only from a directory and all its children directories? Say I have a folder A containing .txt files and subfolders B C etc that contain .txt files and so on and I just want ...
1
vote
1answer
97 views

Copy all files whose hashes don't match

I currently have a hash list (known good) of a selection of various files. I want to copy all files when their hashes do not appear in the hash list to a separate directory. I have got the md5deep ...
0
votes
1answer
199 views

How to do ant style file filtering when copying files

With Ant you can use a filter like: **/target/*.war That means all the paths that have target in them as the last directory. This will match a/b/target/X.war a/target/Y.war a/b/c/target/Z.war ...
1
vote
1answer
101 views

Argument list too long and copying to Samba Share

Ubuntu 12.04 LTS 64 bit. I'm trying to make a scheduled task copy from a directory with thousands of files to a samba share (while skipping duplicates). I mapped my Samba share through the GUI. ...