Skip to main content
Use `../` as OP does in question. Clarify part of answer based feedback from a comment.
Source Link
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 (withhas special or unique semantics different from the standard Unix convention of simply pointing to the directory it resides in; both rm it seems thatand cp seem to treat it doesn't)as a special case.

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.

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.

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 has special or unique semantics different from the standard Unix convention of simply pointing to the directory it resides in; both rm and cp seem to treat it as a special case.

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.

Use `../` as OP does in question.
Source Link
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.

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.

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.

Use similar example names as question.
Source Link
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 ./some-folderfoldersource/. 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 ./some-folderfoldersource/* the argument is first expanded by the shell before the command is ever even executed and passed any arguments. Thus, rm never sees ./some-folderfoldersource/*; it sees the expanded version ./some-folderfoldersource/file1.ext ./some-folderfoldersource/file2.ext ./some-folderfoldersource/folder1childfolder1 and so on. This is important because operating systems limit how many arguments can be passed to a command, usually only a few hundred.

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

With ./some-folder/. 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 ./some-folder/* the argument is first expanded by the shell before the command is ever even executed and passed any arguments. Thus, rm never sees ./some-folder/*; it sees the expanded version ./some-folder/file1.ext ./some-folder/file2.ext ./some-folder/folder1 and so on. This is important because operating systems limit how many arguments can be passed to a command, usually only a few hundred.

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.

Source Link
eestrada
  • 609
  • 6
  • 11
Loading