How do I copy recursively like cp -rf *, but excluding hidden directories (directories starting with .) and their contents?
copy recursively except hidden directory
linux;command line;cp
You could just copy everything withcp -rf and then delete hidden directories at the destination withfind -type d -name '.*' -and -not -name '.' -print0 | xargs -0 rm -rfAlternatively, if you have some advanced tar (e.g. GNU tar), you could try to use tar to exclude some patterns. But I am afraid that is not possible to only exclude hidden directories, but include hidden files.For example something like this:tar --exclude=PATTERN -f - -c * | tar -C destination -f - -xBtw, GNU tar has a zoo of exclude style options. My favourite is--exclude-vcs