How to copy hidden files and hidden subdirectories (the ones starting with a dot) in folder A to folder B? For example if I have this structure:
A/a
A/b
A/.a
A/.b/
A/.b/somefile
A/.b/.c
I would like to copy to B just the hidden files and hidden subdirectories in A:
B/.a
B/.b/
B/.b/somefile
B/.b/.c
I have already tried this command: cp A/.* B from this other superuser question. However, it does not copy the subdirectories. Also tried cp -r A/.* B, but it copies . so I end with an exact copy of A (including the normal files). Any help is appreciated.
..c. – Scott - Слава Україні Oct 27 '14 at 22:27.*[^.]but then you'd miss files that end with a.. I think you would indeed need extended globbing to truly account for all cases. – Omnipresence Oct 28 '14 at 13:08