Questions relating to the Linux 'cp' command.

learn more… | top users | synonyms

0
votes
0answers
30 views

I cant get the cp command to work

I the terminal if I issue the cp command, it states "The program 'cp' is currently not installed. You can install it by typing: apt-get install coreutils" but when I try to install it, i get the ...
1
vote
2answers
49 views

Problem with using wildcards when I do CP command in Terminal

I am new and try to learning Terminal Command. Today I faced some problem with cp wildcard command option. I wrote in Terminal this command cp Downloads/[:alnum:] test/ Here, Downloads is the ...
0
votes
1answer
15 views

sudo cp --preserve=all not preserving ownership

I am trying to copy data back onto an sd card with an ext2 type partition whilst preserving the ownership and permissions. I use the following command: sudo cp -va --preserve=all 2nd/. ...
1
vote
0answers
19 views

How can I modify “cp -ru” to remove files in destination that no longer exist in source?

I have a directory with many subdirectories and several million files. Total size around 15GB. I have a brief window (preferably around 30 seconds) to mirror changes to this directory to a second ...
0
votes
1answer
28 views

How copy totally folders between disk

I used this command to copy all directory to another disk: cp -r -v path_folder_source path_folder_destination The transfer ran alright - I mean I don't know if resulted any error, because I ...
2
votes
1answer
36 views

cp -u copies all files, not just newer ones

I'm sourceing script that says something like cp -vau /home/jordan/local-directory/ -t /media/jordan/A368-480F/BACKUP/ , and that's it. A368-480F/ is the directory that appears when I plug my USB ...
4
votes
2answers
163 views

Problem with input from simple script that copies a file to a different directory

As someone trying to learn bash, I have been making simple scripts to test out various commands. In the following simple script, I am experimenting with the read command. #!/bin/bash read -p "Enter a ...
3
votes
2answers
50 views

copy files by date

How can I copy files in a folder based on when the file was last edited? Lets say I want to copy all my files that I last edited today from c: to my folder bak. How can I achieve that? I know that a ...
1
vote
1answer
97 views

How can I recursively copy files by file extension?

I would like to copy all files with a certain extension that are in sub directories to a different folder. I don't want to maintain the directory structure, I just want to copy all files found to a ...
0
votes
1answer
97 views

How to copy large number of small files to a NTFS external drive?

I have a large number (15K+) of small files of size 3-4 KB each. What is the fastest method to copy those files to a NTFS drive? I tried Nautilus and cp, but they are really slow.
1
vote
1answer
35 views

cp directories and files, preserving directories and overwriting files

I have a directory structure like this: dirHome and inside of it I have dir1, dir2, dir3. All of these directories (dir1, dir2, dir3) each have 3 files inside: file1, file2, file3. I have another copy ...
0
votes
1answer
50 views

What are advantages of “cp” over “rsync”? [closed]

It seems that rsync can do all the work of cp.
0
votes
3answers
95 views

Why won't my cp command copy whole directories? [duplicate]

I've tested the cp command, and it will only copy individual files. For example, I typed cp followed by the exact filename, then typed the directory and the file got copied. However, when I typed the ...
0
votes
2answers
72 views

how to copy from current folder to another folder

how to copy between current directory to another directory eg. i am trying to copy my current directory i.e Desktop to var/www/html cp form.html ./var/www/html receive a following error cp: ...
3
votes
1answer
120 views

Copying multiple files with progress

I want to be able to copy multiple files from multiple USB flash disks at the same time, being able to see current transfer rate of each simultaneously. It is part of performance testing for USB port ...
2
votes
2answers
227 views

How to rename file names to avoid conflict in Windows or Mac?

How can I batch rename file names so that they do not include characters that clash with other file systems as for instance, Screenshot 2015-09-07-25:10:10 Note that the colons are the issue in ...
0
votes
0answers
14 views

How to view progress of cp command in Terminal? [duplicate]

I prefer the CLI environment to the GUI environment, so I often use the cp command to copy instead of doing it through the Nautilus UI, however there is a slight downside to this as when copying large ...
0
votes
0answers
141 views

Why does copy&paste fail from and to a smarthphone's external sd-card (sdcard1) - mtp-probem

I am using Xubuntu 14.04 with Thunar 1.6.3. I cannot copy and paste folders and files from or to the SD-card of my Sony Xperia Z1 compact smartphone. (Everything in the following is translated back ...
3
votes
1answer
234 views

Script running from terminal but not in crontab

My problem is the following: I've made a script called copy.sh in the /var/etc folder in order to copy some .cfg files from there to myfiles #!/bin/bash SHELL=/bin/bash ...
1
vote
1answer
133 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
151 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 ...
6
votes
4answers
4k 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 ...
0
votes
2answers
282 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' ...
2
votes
1answer
5k 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
73 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.
2
votes
3answers
102 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
32 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
68 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
341 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
292 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
211 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
71 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
666 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
99 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
89 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
457 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
165 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
3
votes
1answer
2k 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
31 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
142 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
125 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 ...
4
votes
2answers
4k 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
111 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
30 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
55 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
1answer
94 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
328 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
540 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
295 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: ...