Salix WebsiteDocumentation Site


4.1.4. Copying & Moving & Removing a Folder - cp & mv & rm

So now you have the folder called photo and a log file in the Music directory. This is a little strange as we should normally have the folder not in Music but in Pictures. But now you know how to move a file, perhaps the same command will work for moving a folder?

But...

  cp photo ../Pictures

remember that .. refers to the folder one level up) will give an error like this.

  george[Music]$ cp photo ../Pictures
  cp: omitting directory 'photo/'
  george[Music]$

Let's see what we can do here. The first thing when encountering such a problem is to check the corresponding help file. This can normally be done by issuing a command with an option like cp --help. It is possible that --help will just be -h, and there may be no help at all. man is another command if this is the case.

  man cp

will give a more in-depth explanation of this command. (To get out of the manual, press q).

If you read the help carefully, you will see that you need to give an extra option -r if you wish to copy a folder to another location. So now

  cp -r photo ../Pictures

should copy the photo folder inside the correct Pictures directory. After checking that the folder has been safely copied, you can remove the photo folder from the Music directory:

  rm -r photo/