Questions relating to the Linux 'cp' command.

learn more… | top users | synonyms

1
vote
1answer
20 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
26 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
29 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 ...
0
votes
2answers
25 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 ...
0
votes
2answers
454 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 ...
5
votes
2answers
536 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
29 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, ...
1
vote
1answer
100 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
40 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
29 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 ...
0
votes
0answers
36 views

Is my harddrive broken?

I've got a new 4TB drive. My old (2TB) drive was NTFS formatted. I formatted my new drive with a single 4TB partition to ext4. I've moved content of my old drive to the new drive to format my old ...
5
votes
2answers
410 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 ...
2
votes
3answers
7k 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
66 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
53 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 ...
37
votes
6answers
7k 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
100 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
64 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
84 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
77 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. ...
2
votes
1answer
1k views

Copy only folders not files?

Is there a way to copy an entire directory, but only the folders? I have a corrupt file somewhere in my directory which is causing my hard disks to fail. So instead of copying the corrupt file to ...
0
votes
2answers
292 views

How to move between 2 very different directories in the terminal?

When I move files with a GUI file manager, I navigate to the source and destination directory in 2 different windows, and then drag and drop. Is there a way to do this in BASH (move a file to a ...
0
votes
1answer
1k views

USB drive - cp: cannot create regular file, Read-only file system

I am able to copy files from a USB flash drive, but I cannot get the data (files) into the flash drive. It is showing: cp: cannot create regular file `PENDRIVE/12_angrymen.avi': Read-only file system ...
3
votes
1answer
8k views

cp command to exclude certain files from being copied

Is there a way to use command 'cp' to copy a directory and exclude certain files/sub-directories within it?
0
votes
1answer
431 views

Removing specific characters in string

I am currently writing a bash script and I have obtained a list of file locations. However I have notice that some file locations have spaces in the file name such as eg. : /1 2 3.txt Such files ...
1
vote
2answers
1k views

Why does cp not copy files?

$ ls -la /tee/mysql total 28675 drwxrwxrwx 1 root root 448 Jun 25 13:52 . drwxrwxrwx 1 root root 2896 Jun 25 12:12 .. -rwxrwxrwx 1 root root 18874368 Jun 25 13:19 ibdata1 -rwxrwxrwx 1 root ...
3
votes
3answers
4k views

How to copy a directory from one hard drive to another with every single file?

I have a folder I just luckily recovered sitting on: /media/sdc1/Pictures with a BUNCH of subdirectories and files that I need. I want to copy these to a folder on: /media/sdb1/Pictures What ...
2
votes
2answers
3k views

Copy the content/file to all subdirectory in a directory using terminal

I wanna copy a file to all sub-folders of a folder. A command example would be very helpful.
0
votes
5answers
1k views

Copy files from a directory to a sub-directory (excluding the sub-directory itself)

I have created a folder(directory) named 'Parent' which contains several files(namely 'file1', 'file2'...'file100') and a sub-directory named 'Child1'which itself may contain files and folders . ...
0
votes
2answers
4k views

Copy file to External Hard Disk

My UBUNTU (desktop part) does not boot completely because of low disk space; I logged in to terminal using my username and password, try to copy some file from /home/UserName/Desktop to my external ...
5
votes
2answers
8k views

Ubuntu copying file problem (cannot stat file)

I've faced a problem when copying a file with the commands, cp ~/Downloads/sample.pdf ~/Desktop/ But the terminal gives me a message, cp: cannot stat 'sample.pdf': No such file or directory.
7
votes
4answers
2k views

How to copy into with cp if destination folder already exists?

Example... This is what I want. /tmp $ cp -f -R --verbose /tmp/a /tmp/b `/tmp/a' -> `/tmp/b' `/tmp/a/file2' -> `/tmp/b/file2' `/tmp/a/file1' -> `/tmp/b/file1' This is what I do not want. ...
0
votes
1answer
421 views

issue with cp command when i was copying in /var/www

i am not able to copy file in /var/www with sudo cp /home/index.html /var/www the error is cp:omitting directory '/home/index.html' then i used -r, sudo cp -r /home/index.html /var/www, then the ...
1
vote
0answers
56 views

cp hangs on certain Windows files

I am currently trying to use Ubuntu 9.04 live CD (it's what I had when my computer took a dump) to copy some Windows files from an old drive to a new drive. I'm using cp -Rvf source dest. The issue ...
0
votes
1answer
143 views

Copy entire filesystem in a folder where a raid-1 array is mounted

I am trying to migrate from a single disk drive system to a double disk drive software raid-1 system that already has a running system on it. Meaning that formatting and having a new installation of ...
5
votes
2answers
10k views

Can I verbose output during a copy command processing?

Situation: If I entered a copy command like cp -rf /src/ /dsc/ then I am waiting several minutes for copy large directories. I forgot to put -v flag to verbose an output, Can I do it during copying?
3
votes
2answers
8k views

External backup - “cp: cannot create regular file” error

I have always backed up my home directory to an external hard drive using the cp -r command. Until recently, it worked fine, but now I regularly get the error message cp: cannot create regular file ...