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

Re: Help with command - cp



Sorry for sending this off-list, Gord.  Resending to where it ought to 
have gone in the first place.

On Sunday 26 January 2014 15:09:10 ghaverla wrote:
> Your requirement (to skip hidden files and directories) is what is
> usually required.
>
> But, as a generic rule, you can use the echo command to help with
> analysing how the command line shell might expand a wild card.
>
> echo cp /path/to/src/* /path/to/dest > some_tmp_file
>
> If I do this on my home directory, I could a huge list as I have
> too many files.  Which is why I redirected the output to a file. 
> And looking in the file, I find that there are no hidden
> directories or files copied.
>
> If we look at your command line, you have two switches -R and -p.
> The -R turns on recursive copying, not only is every file
> in .../sourcedir/A copied, every subdirectory of .../sourcedir/A,
> and subdirectories of those, to the end of the file tree is copied.
>  The -p switch asks for the preservation of metadata: ownership,
> groupship, and times.
>
> If you are the owner of the files  under sourcedir/A and you are
> also the owner of destinationdir/B, I would expect the ownership
> and groupship to already be proper, and so it is only the file time
> information which is being preserved.  Preserve is important if
> root is doing the copying.

Thank you very much, Gord.  Most helpful.  I hadn't thought of using 
echo like that.  I obviously need to work on my lateral thinking. :-(

Lisi


Reply to: