I have similar file sturecture:
/home/dave/documents/static/
/home/static/
/home/dave/pictures/static/
/home/dave/otherfolders/
...
I want to copy from this directory only folders named static
. These folders can be also subfolders. And it should form the same structure in new folder it had before. I.e.:
cp -r /home/* /otherhome/
I've tried this:
find home/ -name 'static' -exec cp -r '{}/*' 'otherhome/{}' ';'
But I get errors that /home/dave/documents/static/*
and other static folders don't exist.
I guess I can't concat the filenames with /*
. Any idea how to do it?
static
folder tootherhome
?/otherhome/dave/documents/static/
and other static folders and nothing else.