Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - General
User Name
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.


  Search this Thread
Old 12-05-2003, 12:45 PM   #1
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
LQ 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.


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 > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:40 AM.

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