Command cp error: cp: omitting directory 'move_bb8_square.py'

Hello there, I am typing this copy command: cp move_bb8_square.py move_bb8_square_copy.py and the path I am on is: cd ~/catkin_ws/src/linux_course_files/move_bb8_pkg/my_scripts and yet I am getting this error: cp: omitting directory ‘move_bb8_square.py’
What I might be doing wrong?
Thank you!

Hi @tanmay26 ,

Welcome to this Community!

You seem to be making a copy of an existing file within the same directory.
Your command is correct, but since you say it gives an error try this way instead:

# use ./ to denote current directory
cp ./move_bb8_square.py ./move_bb8_square_copy.py

As an alternative, you can use the IDE file explorer on the left panel to copy-paste or move files wherever you want.

Let me know if this fixed your problem.

Regards,
Girish

Hi @tanmay26,

in addition to what Girish said, I think your move_bb8_square.py “file” is actually a “folder”. Can you double-check that?

If it is a folder (rather than a file) and you want to copy its entire content, you have to copy it using the “-r” param to copy it recursively, like in the example below:

cp -r move_bb8_square.py move_bb8_square_copy.py
  • If the error persists, can you please copy here the complete output, including the command that you executed?
  • Could you also paste here what is the output of the command below?
cd ~/catkin_ws/src/linux_course_files/move_bb8_pkg/my_scripts 

ls -lh