LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Archive dotfiles and dotdirectories only (https://www.linuxquestions.org/questions/linux-software-2/archive-dotfiles-and-dotdirectories-only-644509/)

mjmwired 05-24-2008 12:34 PM

Archive dotfiles and dotdirectories only
 
I'm not exactly sure how to do this.
Is there a quick and easy way to archive ONLY .files and .directories only (i.e. only 'hidden' files)?

I guess I could pipe an ls output and grep for " ." and then incrementally add to an archive. Is there a easier/more reliable way?

MS3FGX 05-24-2008 12:43 PM

I was trying to do the same thing recently and had a pretty tough time finding any answers. With some help from board members I eventually settled on this command, which I incorporated into a simple script.

Code:

ls -A | egrep '^\.' | tar -cvf filename.tar -T -

mjmwired 05-24-2008 12:47 PM

That was fast. Thanks, it is perfect!

amfpg 05-28-2008 10:01 PM

i run your command i my home direktori, but i got this message in the end of line

Code:

ls -A | egrep '^\.' | tar -cvf filename.tar -T -
.Xauthority
.xine/
.xine/catalog.cache
.xsession-errors
.zshrc
tar: Error exit delayed from previous errors

whats wrong with this?


All times are GMT -5. The time now is 06:35 PM.