cp - Command-line tool to copy a file

learn more… | top users | synonyms

4
votes
1answer
1k views

copying device nodes

I'm trying to transfer a working Linux installation to a new larger disk, so I've attached the new disk on a USB port, partitioned it and created filesystems. While copying all the files over I hit a ...
4
votes
2answers
2k views

Permission denied (even as root) on a mounted ISO image with Furius ISO Mount

I mounted a ISO image with Furius ISO Mount. I cd to the mounted directory and tried to copy a file with sudo cp file /dir but cp writes error message cp: cannot stat `file': Permission denied ...
5
votes
3answers
1k views

recursively copy only images and preserve path

I'm working on a website migration. I have a scrape of the site, with all the files and directory structure as you would see them in the URL. I want to pull all images, maintaining the directory ...
3
votes
3answers
341 views

Delete files in a directory which are also in another directory

I copied a directory using this: cp -r dir/ ../../ without thinking and realized that it copied the contents of dir instead of actually dir to the above directory. Now I have a mess of files I need ...
27
votes
4answers
12k views

Difference Between cp -r and cp -R (copy command)

cp- r is meant to copy files recursively, and cp -R for copying directories recursively. But I've checked, and both appear to copy both files and directories, the same thing. So, what's the difference ...
4
votes
3answers
3k views

How do I move some but not all files from one directory to another?

I need to move my files from one directory to other. But there is some issues. My file name pattern is like: apple.0, apple.<n>, n -> {0,1,2,3 ...~ } so mv apple.* will not work, because ...
4
votes
1answer
375 views

ACL mask does not work as expected

If I copy a file with a base ACL of: u::rw-,g::r--,o::r-- into a directory with a default ACL of: u::rwx,g::r-x,g:users:rwx,m::rwx,o::r-x I obtain a file with mask of m::r--. I would have ...
25
votes
2answers
7k views

Why doesn't cp have a progress bar like wget?

Please note that I don't ask how. I already know options like pv and rsync -P. I want to ask why doesn't cp implement a progress bar, at least as a flag ?
2
votes
2answers
296 views

How to update a content management installation by overwriting existing files via ssh and shell?

I have installed a cms (modx) on a webserver running CentOS 5 and Apache 2.2. Now there is a new version and I would like to update it. The instructions in the modx-wiki suggest to overwrite the ...
1
vote
2answers
1k views

Is there a BASH command for copying all files from a directory tree and putting all the files in a single directory?

I have a ton of notes categorized into folders, but I think it might be better to put them all into one folder instead. Is there an easy way to do that?
4
votes
1answer
2k views

Batch copy and rename with regexp

I am wondering whether there is a way how to copy and rename a bunch of files without scripting. I have files with names like prefix_12345678901_12345678901_suffix.ext and I need to copy all of them ...
6
votes
5answers
4k views

How to copy all html files from a directory tree to a single directory?

I want to copy all the .html files in myDir and its subdirectories to ~/otherDir. Here's what I tried (it doesn't work): $ find myDir -name *.html -print | xargs -0 cp ~/otherDir usage: cp [-R [-H | ...
6
votes
4answers
15k views

Copy multiple files from filename X to filename Y?

I'm pretty noob when it comes to unix commands. What I want to do is to copy files within a lexicographic range. Example of files: -rw-r--r-- 1 root root 15276 Oct 5 2004 a2ps.cfg -rw-r--r-- ...
2
votes
2answers
2k views

Copy multiple files and append to end of filename

Seems like I really shouldn't need to create a script for this. I'd like to do something cp /etc/*.conf $1.orig or cp /etc/{a.conf,b.conf} _firstarg_.orig Is there a quick and painless way of doing ...
5
votes
2answers
1k views

Copy from linux to windows every minute

I currently quickly setup a way to copy files from my linux machine to a windows share that multiple people can access, but I'm looking for a better way. In Windows 7, I made a folder accessible to ...
0
votes
2answers
572 views

SSH Copy Limit?

So I have a small little Ubuntu server set up, with some rather large files that I've allowed a few people to copy from their putty window. Anyways 2 questions: Lets say a person on windows wants to ...
14
votes
2answers
1k views

What happens if a file is modified while you're copying it?

What is the effect of copying a file say fileA.big (900mb) from location B to locationC. If during that cp operation, say 35% through the process, fileA.big is appended with new information and grows ...
4
votes
4answers
1k views

Copy text from one terminal into another

I am logged into ssh to a university account from my home computer. Then I find a file that I want to copy onto my local system. So I open a new shell terminal and am about to use scp to copy that ...
27
votes
3answers
31k views
0
votes
1answer
940 views

Why can I not copy a direcotry from *nix to a mounted smbfs share on Windows 7?

I've mounted a Windows 7 directory on my FreeBSD box via smbfs: mount ... //ROOT@BARYONYX/GVKV on /usr/home/gvkv/win (smbfs) but for some reason when I try to copy a directory: cp .vim /win I ...
10
votes
3answers
6k views

copy recursively except hidden directory

How do I copy recursively like cp -rf *, but excluding hidden directories (directories starting with .) and their contents?