Shell – the difference between * and *.* while copying

command linecpshellshell-script

What is the difference between following 2 commands?

cp -rp /dir1/*.* /dir2/
cp -rp /dir1/* /dir2/

Best Answer

*.* only matches filenames with a dot in the middle or at the end. For example:

abc.jpg
def. 

* matches the filenames above, plus the names which don't have a dot at all. for example:

data
Related Question