copy only non-hidden files

Ralf Mardorf silver.bullet at zoho.com
Tue Oct 24 02:49:45 UTC 2017


On Tue, 24 Oct 2017 04:26:04 +0200, Ralf Mardorf wrote:
>On Tue, 24 Oct 2017 03:58:43 +0200, Ralf Mardorf wrote:
>>On Mon, 23 Oct 2017 22:32:48 +0000 (UTC), thufir wrote:  
>>>From time to time I see different scripts or techniques on this 
>>>question.  The best approach I've seen yet is:
>>>
>>>
>>>
>>>rsync -av --exclude=".*" src dest
>>>
>>>https://stackoverflow.com/a/11557219/262852
>>>
>>>
>>>
>>>the rare time when I want to do this then I spend time trying to
>>>recall how to even find that solution.  Is there another tool or
>>>approach, perhaps?    
>>
>>The link you posted already is giving the pointer to globbing. IMO the
>>argument that "it would copy any hidden files in the next level
>>of sub-directories" is strange, since it's unusual to hide something
>>inside a hidden parent directory. The "asterisk" is your friend,
>>issues caused by "hidden files in the next level of sub-directories"
>>are very unlikely, respectively if there should be levels of hidden
>>items, it would be strange to exclude them unconditionally. A
>>hierarchical file system should make sense, if it's based on
>>arbitrariness, it isn't a hierarchical file system anymore.  
>
>PS:
>
>You could use the "asterisk" on more than just one level, e.g.
>"/home/*/*".

PPS:

JFTR the "tool" could be the shell, for example

  what_command_ever $(ls -d /home/*/* | grep -ve this | grep -e that)

The above is a little bit idiotic, I only want to demonstrate that a
command could use another command with pipes etc..










More information about the ubuntu-users mailing list