View previous topic :: View next topic |
Author |
Message |
Tii l33t
Joined: 02 Jan 2004 Posts: 733
|
Posted: Thu Jun 24, 2004 8:57 pm Post subject: Stupid cp question |
|
|
I'm feeling really stupid that I can't cp some files from one place to another. I've read the man page but I didn't get any smarter. I used to have my computer with one user I will call olduser. I have her homedirectory backed up in /mnt/backup/home/olduser. Now after I've reinstalled that user is named newuser. I want to move all the files from her old home directory to the new one. I tired it like so "cp -aR /mnt/backup/home/olduser/* /home/newuser". Most of the stuff is copied correctly and the permissions are right but some files aren't copied. The most bugging thins is the fvwm config file in /home/user/.fvwm/.fvwm2rc. I'm thinking that maybe it has something to do with the fact that the files starts with a dot in a directory that starts with a dot but I'm not sure. I could just cp the files by hand but I'm not sure what else is not being copied and there are over 5 gigs worth of all kinds of files there. |
|
Back to top |
|
|
papal_authority Veteran
Joined: 31 Mar 2004 Posts: 1823 Location: Canada
|
Posted: Thu Jun 24, 2004 9:00 pm Post subject: |
|
|
AFAIK * matches all files that don't start with a dot. |
|
Back to top |
|
|
Tii l33t
Joined: 02 Jan 2004 Posts: 733
|
Posted: Thu Jun 24, 2004 9:08 pm Post subject: |
|
|
papal_authority wrote: | AFAIK * matches all files that don't start with a dot. |
Ok, I thought it was something like that. How would I go about doing this cping then so that all the files are copied? |
|
Back to top |
|
|
tomk Bodhisattva
Joined: 23 Sep 2003 Posts: 7221 Location: Sat in front of my computer
|
Posted: Fri Jun 25, 2004 1:44 am Post subject: |
|
|
If you just specify the directory it copies all the hidden files as well, but it will copy the entire directory, so if you do this:
Code: | cp -a /mnt/backup/home/olduser /home/newuser |
Then you will have a /home/newuser/olduser directory. If /home/olduser doesn't exist the best thing to do is this:
Code: | cp -a /mnt/backup/home/olduser /home
mv /home/{olduser,newuser} |
_________________ Search | Read | Answer | Report | Strip |
|
Back to top |
|
|
Tii l33t
Joined: 02 Jan 2004 Posts: 733
|
Posted: Fri Jun 25, 2004 9:32 am Post subject: |
|
|
tomk wrote: | If you just specify the directory it copies all the hidden files as well, but it will copy the entire directory, so if you do this:
Code: | cp -a /mnt/backup/home/olduser /home/newuser |
Then you will have a /home/newuser/olduser directory. If /home/olduser doesn't exist the best thing to do is this:
Code: | cp -a /mnt/backup/home/olduser /home
mv /home/{olduser,newuser} |
|
I tried it your way and I still ended up having /home/newuser/olduser. Then I got really pissed off and started fvwm with all the uglyness, fired up konqueror and used it to copy all the files. Then I realized that there were some files owned by root there but I can sort it out later. It's kinda stupid that with all the power of the command line I can't get such a simple thing done. |
|
Back to top |
|
|
zaragon n00b
Joined: 19 May 2003 Posts: 14 Location: Sweden
|
Posted: Fri Jun 25, 2004 9:55 am Post subject: |
|
|
Note: the /home/newuser/ must exist for the following to work!
Code: | cp -aR /mnt/backup/home/olduser/.[^.]* /home/newuser/.
|
should do it, will copy all files starting with '.' except '..'
Actually, that is more usable to copy only .-files/dirs, you can do
Code: | cp -aR /mnt/backup/home/olduser/. /home/newuser/.
|
to copy everything including .-files/dirs. |
|
Back to top |
|
|
|