command to copy hidden files?

Lyvim Xaphir knightmerc at yahoo.com
Wed Jan 24 00:44:26 UTC 2007


On Mon, 2007-01-22 at 06:07 -0800, Dave Stevens wrote:
> Hi 
> 
> I've tried to copy files from my home folder to do a disk upgrade. I
> foolishly only copied the visible (non-dot) files. Now I'd like to copy
> only the . files (recursively) but don't see what the syntax is. Anyone?
> 
> Dave
> 

If you want to get a listing of all the dot files in the directory, do

ls -a | grep '^\.'

If you've already copied the non-dot files and you just want to grab the
dot files from the current directory and send them to a destination, do

$ ls -a | grep '^\.' |xargs cp -vax -t /destination/directory

Note that this will grab the dot-directories and their contents as
well. 

If you want to grab everything wholesale from the current directory,
(including the dot dirs), and copy that to your desired destination,
then do this:

ls -a |xargs cp -vax -t /destination/directory

If you'd like to tarball the current directory with just the dot files,
then:

ls -a | grep '^\.' |xargs tar -cvf dotdir_backup.tar

Then you can copy the dotdir_backup.tar to wherever and then extract in
that other remote directory.  Handy for ftp or network transfers, or
even a transfer via a USB drive.  For maximum compression use -jcvf
instead of -cvf.

A simple way to copy an entire home directory including dotfiles is to
do this:

cd /home

cp -vax yourhomedir /destination/directory

Bear in mind that this will result in

 /destination/directory/yourhomedir/"all your files"

Rather than 

/destination/directory/"all your files"




Rots of ruck! :)


LX


-- 
°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
Off Topic or Political Discussions:
http://mandrakeot.mdw1982.com/
http://www.mdw1982.com/mailman/listinfo/mandrakeot

"Character is what you do when nobody's looking." - J.C. Watts
°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°




More information about the fedora-list mailing list