How to copy only non-hidden files (GNU/Linux)
Go to the source directory and execute the following command.
cp -iv --parents `find . -type f | regexmatch '.*/\..+' 1` -t TARGET
TAREGT is the target directory.
For this you need regexmatch and ruby. You can install ruby via
apt-get install ruby and regexmatch can you download from here.
find SRC -type f lists all files from the source directory and forward it to regexmatch by a pipe (the "|" bar). As second
regexmath '.*/..+' 1 removes all files from the list, which path contains a part that starts with a dot (means its hidden). Then copy all these files to
TARGET and create their parent directories.
There is the dot "." in
find because then all paths returned, now starting with this dot, which is a special link to the current directory. So if you copy
./file.txt from the source directory to the target directory it will copied from
./file.txt (where . means the source directory) to
targetdir/./file.txt (where the dot refers to target dir). Genius.
find -not -iname ".*" (?)