Questions relating to the Linux 'cp' command.

learn more… | top users | synonyms

3
votes
1answer
25 views

Make Folder a symbolic link to two folder?

I would like to have Ubuntu's default music folder /home/$USER/Music to act pretty much as a library would in Windows. Essentially it would be a virtual folder containing the contents of other ...
1
vote
1answer
89 views

How can I copy all files and folders from one directory to another with similar structure with `find` and `xargs`?

For example, I use find command find /usr/share/icons -iname 'foxitreader*' find the files: /usr/share/icons/hicolor/32x32/apps/FoxitReader.png /usr/share/icons/hicolor/48x48/apps/FoxitReader.png ...
-1
votes
0answers
9 views

How to copy files from one location to another location using crontab

How do I copy files every five minutes from /var/log to /var/tmp , these are my requirements 1.every five minutes copy messages* files from /var/log to /var/tmp 2.create a directory everyday in ...
1
vote
0answers
19 views

How to copy a directory in Terminal? [duplicate]

With the cp command I can copy files in folders, but is there any way to actually copy folders into other folders, for instance when running: cp Pictures/ Videos/Pictures/ I get the following error ...
0
votes
1answer
31 views

What is the difference in using cp and dd when cloning USB sticks?

I found that there are at least two methods to clone a USB stick: (with /dev/sdb as the source while /dev/sdc the target) Cloning with cp: sudo cp /dev/sdb /dev/sdc Cloning with dd: sudo dd ...
1
vote
2answers
36 views

cp Directory target can't be found Ubuntu 14.04

I'm trying to replace the startup sound on my ubuntu, desktop-login.ogg, with my own, Desktop-login.ogg (located in the Downloads folder) by doing the following: sudo cp desktop-login.ogg.old sudo cp ...
1
vote
1answer
57 views

How to copy everything from one directory to another using 'cp' command? [duplicate]

I know that we can copy things from one directory to another using the command: cp -Ri /path/one/* /path/two/* Here: R = recursive i = interactive My questions: Does this command copy ...
1
vote
1answer
30 views

How does one properly copy a file into multiple folders and subfolders without overwriting the file contents in the destination folders?

I actually tried an existing answer from: How to copy a file to multiple folders using the command line? where I used the command: find folder -exec cp file.txt {} \; I wanted to use this because I ...
0
votes
0answers
22 views

cloning install filled partition

I cloned a linuxmint install from a 300gb HDD to a 1tb HDD using the command: sudo cp -afv /path/to/source/* /path/to/destination It took a lot longer than expected, when it finished I realised the ...
0
votes
2answers
21 views

Rename on move with placeholder / wildcard

Lets say I have the following files /home/user/test1.java /home/user/test2.java /home/user/test3.java /home/user/test1.java.orig /home/user/test2.java.orig /home/user/test3.java.orig I want the ...
1
vote
1answer
206 views

I can't get the `cp` command to work

In the terminal, when 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
85 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
56 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
26 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
31 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
48 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
206 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
139 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 ...
2
votes
1answer
178 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
138 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
48 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
70 views

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

It seems that rsync can do all the work of cp.
0
votes
3answers
154 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
1answer
91 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
173 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
395 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 ...
1
vote
0answers
197 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
395 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
377 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
261 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
6k 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
582 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
7k 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
89 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
130 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
33 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
95 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
691 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
343 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
274 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
81 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
977 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
112 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
120 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
751 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
184 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
32 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 ...