OT (ish): How to copy hidden files/directories

Robert P. J. Day rpjday at mindspring.com
Sat Oct 9 18:11:09 UTC 2004


On Sat, 9 Oct 2004, Mike Noble wrote:

> Scot L. Harris wrote:
>> On Sat, 2004-10-09 at 03:47, CB wrote:
>> 
>>> I can't figure out how to do this: copy (or move) all the hidden files
>>> and directories contained in one directory to another directory.
>>> 
>>> Is it as embarrasingly simple as I imagine it must be?
>> 
>> 
>> cp .* /newdirectory
>> 
>> That will copy all hidden files (files that start with .) to a new
>> directory.
>> 
>> You can combine that with other options of cp.  Check the man for cp page 
>> for those.
>> 
>
> This is a really bad example. .* will also copy . and ..
> If you want to make sure that you only copy the dot files
> in a directory you want to use the command:
>
> cp -Ra .??* /newdirectory

and what if you have a hidden file (or directory) named ".a"?

rday




More information about the fedora-list mailing list