copy only non-hidden files

Duane Whitty duane at nofroth.com
Tue Oct 24 12:46:21 UTC 2017



On 17-10-24 12:12 AM, Ralf Mardorf wrote:
> On Tue, 24 Oct 2017 05:10:43 +0200, Ralf Mardorf wrote:
>> On Tue, 24 Oct 2017 05:06:23 +0200, Ralf Mardorf wrote:
>>> On Tue, 24 Oct 2017 04:56:05 +0200, Ralf Mardorf wrote:  
>>>> On Mon, 2017-10-23 at 23:40 -0300, Duane Whitty wrote:    
>>>>> Wouldn't cp /home/duane/*/* /home/someone/ result in my .gnupg
>>>>> directory being copied?      
>>>>
>>>> I mentioned "globbing"
>>>>
>>>>  http://lmgtfy.com/?q=shell+globbing
>>>>
>>>> What do you get, if you run
>>>>
>>>>  ls -d /home/*/*
>>>>
>>>> or
>>>>
>>>>  ls -d /home/*/*/*
>>>>
>>>> ?
Indeed, no hidden files or directories!  Very enlightening.  Thanks!

>>>
>>>
>>> FWIW
>>>
>>> You probably did not mean cp /home/duane/*/* , but cp /home/duane/* ,
>>> right?  
No, I meant /home/duane/*/* to stay consistent with your example.  If I
had some reason to do this I would use /home/duane/*
>>
>> However, if you really meant cp /home/duane/*/* , since I mentioned
>> levels of "asterisks", then remember that I also mentioned a sane
>> hierarchical file system. Do you expect levels of hidden items in
>> $HOME?
No, I wouldn't expect multiple levels of hidden items in $HOME
> 
> Either way, it wouldn't copy .gnupg !
> 
> 
I have to admit I was a little dubious about using the "ls" command in
these examples so I tried them out using "echo /home/duane/*" and "echo
/home/duane/*/*"

The globbing rules are the same regardless.  So thanks for the detailed
explanation.  I appreciate your time.

Best Regards,
Duane

-- 
Duane Whitty
duane at nofroth.com




More information about the ubuntu-users mailing list