[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Help with command - cp



On 1/27/14, Zenaan Harkness <zen@freedbms.net> wrote:
> On 1/27/14, Lisi Reisz <lisi.reisz@gmail.com> wrote:
>> I am wanting to use the CLI to copy some files from dirA to dirB.  I
>> want to exclude all hidden files.  Will this command achieve it? :--
>>
>> cp -Rp /path/to/sourcedir/A/* /path/to/destinationdir/B
>
> BTW, with GNU ls, -r is the same as -R, but doesn't require pressing <Shift>
> :)
>
> Your command will exclude files and dirs beginning with period ('.'),
> in the directory /path/to/sourcedir/A/
> but not "hidden" files in subdirectories (I note your -R/-r option).
> If you really are only copying files, then -r is not needed.

PS, I usually use /path/to/destinationdir/B/ , rather than
/path/to/destinationdir/B , when "B" is meant to be a directory - it
sometimes gives better error output, and also is a very good habit to
get into if you start to use rsync.

Which reminds me, rsync is often a better cp; I often use it locally,
not only to copy between separate computers/hosts.


Reply to: