Skip to main content
2 of 4
Use similar example names as question.
eestrada
  • 609
  • 6
  • 11

There is a fundamental difference between these two argument forms. And it's an important one to understand what is happening.

With ./foldersource/. the argument is passed unchanged to the command, whether it's cp or rm or something else. It's up to the command whether that trailing dot makes any sense (with rm it seems that it doesn't).

With ./foldersource/* the argument is first expanded by the shell before the command is ever even executed and passed any arguments. Thus, rm never sees ./foldersource/*; it sees the expanded version ./foldersource/file1.ext ./foldersource/file2.ext ./foldersource/childfolder1 and so on. This is important because operating systems limit how many arguments can be passed to a command, usually only a few hundred.

eestrada
  • 609
  • 6
  • 11