Once again, I ned to remind people about how this works:

1. To copy all files which begin with a dot to some destination directory:

cp .* destdir

Note that .* will not discriminate between files and directories. Use at
your own discretion.

2. cp .[0-9a-zA-Z]* destdir

Note that this will not get all files that begin with a dot. It will only
get the files that begin with a dot that have a digit or a letter as a
second character.

3. If you wnt to copy all files which begin with a dot but whose second
   character is not a dot, you may use the following construct:

cp .[^.]* destdir

4. You are allowed to use more complex patterns using 

shopt extglob

These are disabled by default because the metacharacters used would
conflict with other bash functionality. See the bash man pages.

5. And finally how do we grab only files from the directory without
   grabbing directories?

find . -maxdepth 1 -type f -name .\* -print | cpio -pdvum destdir

The maxdepth says "Don't dive in, type says only give me files, and name
says only give me file that begin with a period.

-- 
-Time flies like the wind. Fruit flies like a banana. [EMAIL PROTECTED]
-Stranger things have happened but none stranger than this. Steven W. Orr-
Does your driver's license say Organ Donor?Black holes are where God \
-------divided by zero. Listen to me! We are all individuals!---------

On Fri, 7 Jul 2000, rpjday wrote:

=>On Fri, 7 Jul 2000, Brian Wright wrote:
=>
=>> Hi, list!
=>> 
=>> Is there a quick and dirty way to copy all hidden files with cp?  I tried
=>> using cp .* but that also gets ..
=>> 
=>> I would do cp .a* .b* ... .z* but that would be a pain to type. :)
=>
=>cp .[!.]* <dest dir>
=>cp .[^.]* <dest dir>
=>
=>  both appear to work in bash, but they will also match any 
=>hidden directories.
=>
=>rday
=>
=>------------------------------
=>




-- 
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.

Reply via email to