Skip to content
Advertisement

Newbie-ish error: cp: omitting directory

Pulling my hair as I’m stuck with a basic error without understanding why:

JavaScript

We’re in a “test” directory, in which I created one “del” subdirectory. The “test” directory contains a variety of files of various types.

The result is a series of lines (same number as the number of files present in the directory from where the command is ran) with:

JavaScript

Possibly useful details follow.

  • Debian Wheezy, standard shell interface.
  • As a prelude to more complex exclusion and exec patterns I wanted to start with this fundamental test… and had this.
  • I think I excluded the “del” directory with “type -f”, so it’s not as if I was asking Linux to move a directory within itself.
  • There are no other directories or subdirectories.
  • Permissions: everything belongs to the current user.
  • I made variations for the “cp del” part, putting it in simple or double quotes, or using ./del, no difference.

I also tried with -R

JavaScript

That gave:

JavaScript

Same with -r

Advertisement

Answer

If what you’re trying to do is to copy some files found by find command to the del directory, then you can do it like this:

JavaScript

Or like this:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement