LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 12-05-2003, 12:45 PM   #1
Guru3
Member
 
Registered: Sep 2003
Location: //home/sweden
Distribution: RedHat 9, Fedora Core 1
Posts: 360

Rep: Reputation: 31
Copying Hidden Directories


I am making a backup of my home directory, and when I tried like cp -ar * /home/home-bkup and it didn't copy those directories that start with a . and my question is how do I do that?
 
Old 12-05-2003, 12:59 PM   #2
wapcaplet
Guru
 
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018

Rep: Reputation: 48
Check out this post. Tricky, but it should work

So I guess the command you'd want is:

cp -ar * .[^.]* /home/home-bkup

The junk with the brackets just tells cp to also copy anything beginning with a dot, but not beginning with two dots (to prevent it from copying everything in the parent directory also). The same technique can also be used with rm, to remove hidden files, but be careful with it in that case, especially if you are running as root! You could very easily remove a whole bunch of stuff you didn't mean to.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copying hidden files recursively? mrd Linux - General 1 09-30-2005 07:51 AM
hidden directories Alwyn Linux - Newbie 1 07-19-2005 06:24 AM
K3B won't back up hidden directories racsw Linux - Software 3 11-21-2004 08:12 PM
copying hidden files Frustin Linux - General 19 08-27-2004 09:14 PM
Reading Multisession CDs and MS hidden directories in Linux cedillo Linux - Newbie 0 12-17-2002 01:46 PM


All times are GMT -5. The time now is 11:43 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration