I'm having trouble with grep's manner of interpreting "recursive" searching compared to cp. Maybe it's just that I use them differently.
In this, grep seems to interpret "recursive" differently from cp. Is that correct? (my question)
Per my Question to navigate through this on SO...
With files containing the grep-matched string:
./file1.js ./file2.php ./inc/file3.js ./inc/file4.php ./inc.php/file5.php grep -R "find me" *.php Returns:
./file2.php ./inc.php/file5.php ...because grep wants to match both directories and files containing ".php"
But, if I use cp to copy recursively, say:
cp -r inc/* ~/mywork/ Files in the "inc" folder will be copied, along with all directories et cetera, albeit not hidden files, regardless of whether they have "inc" in their name.
Do grep and cp have different meanings of "recursive" or do they treat "recursive" the same? Could someone help me understand how different path/file arguments are interpreted by cp and grep the same way?