3
votes
3answers
1k views

How to copy one file into multiple subfolders at once on a Linux server?

I have a folder on a Linux server with 35+ subdirectories, along the lines of: aa.foo.bar.baz ab.foo.bar.baz .. bp.foo.bar.baz I have a file that I want to copy into each of those subdirectories. ...
2
votes
1answer
89 views

Copy everything in a subdirectory across to the relevant subdirectory elsewhere

At the moment I'm doing: for i in mdx/[0-9][0-9].png; do cp $i ../../d_s_c/images/mdx ; done But as well as the directory mdx, I also have other directories called ntt, etc. How can I say 'For ...
0
votes
2answers
171 views

cp command can't find some directories

I'm trying to copy a bunch of files/directories using a terminal command, cp. The command I'm using is: sudo cp -r *.tests ~/Desktop tests are directories with stuff in them. However I get a few ...
5
votes
1answer
985 views

Why does du -sl show different sizes for the source and result of a cp -rl?

I have used cp -rl to copy a folder. When measuring the size of the source and of the result of the copy du -sl returns slightly different sizes, even though diff confirms that their content are ...
12
votes
4answers
8k views

How to copy symlinks to target as normal folders

i have a folder with symlinks: marek@marek$ ls -al /usr/share/solr/ razem 36 drwxr-xr-x 5 root root 4096 2010-11-30 08:25 . drwxr-xr-x 358 root root 12288 2010-11-26 12:25 .. drwxr-xr-x 3 root ...
1
vote
2answers
1k views

Find files in subdirectories and copy them to another directory with the same subdirectories?

This question is very similar to this one except that I want to maintain the file's original subdirectories. For example if I had /temp/a/a.txt /temp/a/a.jpg /temp/a/b.txt /temp/b/c.txt ...
1
vote
2answers
213 views

argument to cp in backticks doesn't work?

I tried using a command like cp `ls ~/temp/*.xyz | head -1` ./ But that does not work. If I echo the value of command inside back ticks and put it manually in cp command it works. Any ideas?
0
votes
1answer
115 views

Moving only the contents of a map and not the map itself on linux

Using the cp command, one can move files and folders on linux. I want to make a new user and move the contents of the skeleton map to their home directory. I use this command: cp -r /etc/skel/ ...
51
votes
6answers
74k views

How to copy symbolic links?

I have directory that contains some symbolic links: user@host:include$ find .. -type l -ls 4737414 0 lrwxrwxrwx 1 user group 13 Dec 9 13:47 ../k0607-lsi6/camac -> ../../include 4737415 ...
2
votes
2answers
14k views

cp: reading `filename': Input/output error WHY?

I wish to know what could be the possible cases for this error: cp: reading `filename': Input/output error I am getting this message when I am trying to copy a big file of around 50MB.
5
votes
2answers
8k views

Use rsync to copy all files except for certain filenames with a certain extension

I have two same-size flash cards, and I want to copy contents of one to the other based on the following rules: I want all directories and subdirectories in place I want to exclude files of type ...