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.