Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Stupid cp question
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Tii
l33t
l33t


Joined: 02 Jan 2004
Posts: 733

PostPosted: Thu Jun 24, 2004 8:57 pm    Post subject: Stupid cp question Reply with quote

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
View user's profile Send private message
papal_authority
Veteran
Veteran


Joined: 31 Mar 2004
Posts: 1823
Location: Canada

PostPosted: Thu Jun 24, 2004 9:00 pm    Post subject: Reply with quote

AFAIK * matches all files that don't start with a dot.
Back to top
View user's profile Send private message
Tii
l33t
l33t


Joined: 02 Jan 2004
Posts: 733

PostPosted: Thu Jun 24, 2004 9:08 pm    Post subject: Reply with quote

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
View user's profile Send private message
tomk
Bodhisattva
Bodhisattva


Joined: 23 Sep 2003
Posts: 7221
Location: Sat in front of my computer

PostPosted: Fri Jun 25, 2004 1:44 am    Post subject: Reply with quote

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
View user's profile Send private message
Tii
l33t
l33t


Joined: 02 Jan 2004
Posts: 733

PostPosted: Fri Jun 25, 2004 9:32 am    Post subject: Reply with quote

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
View user's profile Send private message
zaragon
n00b
n00b


Joined: 19 May 2003
Posts: 14
Location: Sweden

PostPosted: Fri Jun 25, 2004 9:55 am    Post subject: Reply with quote


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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum