FAQ: Manipulation - cp Part II

reading the directions i though i would be able to list the two text files in a row. instead i had to list each file with a full pathway: cp drama/next directory/text file drama/next directory/text file drama/directory to go to/

In step 1, it says you should be in the movies directory, but when I did pwd, it told me I was still in the biopic directory. I tried using cd historical/ and cd drama/historical/, but I always got the message “No such file or directory”. How was I supposed to get to the general movies directory?
I had a similar issue in step 2, as I wanted to navigate to the historical directory and then do ls, but it again wouldn’t move.

Was I using cd wrong in these scenarios? Using slashes didn’t change anything, so I’m struggling to figure out there purpose as well.

I think the course was changed in that you now stay where you left off in the previous exercise. The instructions were written at a time when, I believe, you would always be reset to start off in the movies directory. You get No such file or directory because if you’re in biopic, historical isn’t a subdirectory. To pass, just navigate to movies from your current directory, then start completing the steps from the beginning. Remember that you can use .. to navigate up one directory. Here’s the filesystem for your reference.

When trying to list for accounts in a separate directory to the active one, do we need to state the most “parent” directory?

For this exercise, it uses this file structure: https://static-assets.codecademy.com/Courses/learn-the-command-line/LCL-fileTrees-02.png

Here, if I am in the historical directory, would I need to write

ls movies/action/superhero
In order to see the files inside the superhero directory?

In addition, if I am in the movies directory, would I need to type out:

ls movies/comedy

In order to list out the files under comedy?

You have the right idea but unfortunately that diagram doesn’t show the full path. Unix paths always start from the root directory /. So the movies directory isn’t the absolute parent; in this example the movies/ directory is actually more like-
/home/ccuser/workspace/movies

You have two options to specify filepaths for commands like this. Either a full or absolute path which starts from the / root directory or a relative path that starts from your working directory (you can see this if you use the pwd command).

To list the contents of the superhero directory using an absolute path-

ls /home/ccuser/workspace/movies/action/superhero

Now for a relative path. In your example you state you are in the “historical” directory so your current working directory would be-
/home/ccuser/workspace/movies/drama/historical
In order to list the contents of the superhero/ directory with a relative path you would need to use-

ls ../../action/superhero

The two sets of .. each go up one directory. In this example starting from historical the first one goes up to /home/ccuser/workspace/movies/drama and the second goes to /home/ccuser/workspace/movies/ from which /action/superhero gets us where we want to go.

Regarding your second point, no. If your working directory was movies/ then ls comedy is all you need.

2 Likes

Hello! i need help with coping these two files from drama and moving over to historical.
i know that i’m in the right directory ‘Movies’. And i’ve tired following the guide word for word:
cp drama/biopic/ray.txt drama/biopic/notorious.txt drama/historical/
which brings back “cannot stat ray.txt or notorious.txt. No such file or directory”
i’ve tired using just ray.txt and notorious.txt; with spaces and without spaces; with commas and without commas;
I can copy the individual from just like the previous section Manipulation- CP 1. Please help me understand, what i’m doing wrong.

i’ve found the answer on line. nvm.


stucked

2 Likes

answer 2 : ls drama/historical/
and press enter

type the pwd command. Note that we’re back in the movies/ directory again.

Copy drama/biopic/ray.txt and drama/biopic/notorious.txt into the drama/historical/ directory.

cp biopic/cleopatra.txt historical/
cp: cannot stat ‘biopic/cleopatra.txt’: No such file or directory
$ cp biopic/cleopatra.txt historical.txt
cp: cannot stat ‘biopic/cleopatra.txt’: No such file or directory
$ cp biopic/cleopatra.txt …/historical
cp: cannot stat ‘biopic/cleopatra.txt’: No such file or directory
$ cp biopic/cleopatra.txt historical/
cp: cannot stat ‘biopic/cleopatra.txt’: No such file or directory
$ cd movies/biopic
bash: cd: movies/biopic: No such file or directory
$ cd movies/
$ cd drama/
$ cd biopic/
$ cp biopic/cleopatra.txt historical/
cp: cannot stat ‘biopic/cleopatra.txt’: No such file or directory
$ cp cleopatra.txt historical/
cp: cannot create regular file ‘historical/’: Not a directory
$ cp cleopatra.txt historical.txt/
cp: cannot create regular file ‘historical.txt/’: Not a directory
$ cp cleopatra.txt
cp: missing destination file operand after ‘cleopatra.txt’
Try ‘cp --help’ for more information.
$ cp cleopatra.txt historical.txt/
cp: cannot create regular file ‘historical.txt/’: Not a directory
$ cp cleopatra.txt historical
$ pwd
/home/ccuser/workspace/movies/drama/biopic
$ cp biopic/cleopatra.txt historical
cp: cannot stat ‘biopic/cleopatra.txt’: No such file or directory
$ cp biopic/cleopatra.txt historical/
cp: failed to access ‘historical/’: Not a directory
$ cp cleopatra.txt …/historical
$ ls
cleopatra.txt frida.txt historical lincoln.txt notorious.txt ray.txt
$ ls historical/
ls: cannot access ‘historical/’: Not a directory
$ pwd
/home/ccuser/workspace/movies/drama/biopic
$ cp drama/biopic/ray.txt drama/biopic/notorius.txt drama/historical
cp: target ‘drama/historical’ is not a directory
$ cd movies/
bash: cd: movies/: No such file or directory
$ pwd
/home/ccuser/workspace/movies/drama/biopic
$ cd .
$ pwd
/home/ccuser/workspace/movies/drama/biopic
$ cd …/
$ pwd
/home/ccuser/workspace/movies/drama
$ cd …/
$ pwd
/home/ccuser/workspace/movies
$ cp drama/biopic/ray.txt drama/biopic/notorius.txt drama/historical/
cp: cannot stat ‘drama/biopic/notorius.txt’: No such file or directory
$

that is what I have gotten so far but I cannot get past step one on this

type the pwd command. Note that we’re back in the movies/ directory again.

Copy drama/biopic/ray.txt and drama/biopic/notorious.txt into the drama/historical/ directory.

pwd
/home/ccuser/workspace/movies
$ drama/biopic/ray.txt drama/historical
bash: drama/biopic/ray.txt: Permission denied
$ drama/biopic/ray.txt drama/historical drama/biopic/notorious.txt dramna/historical
bash: drama/biopic/ray.txt: Permission denied
$

what am I doing wrong on this step
step 1
copy multiple files in a directory

pwd
/home/ccuser/workspace/movies
$ cp drama/biopic/ray.txt drama/biopic/notorious.txt drama/historical/
$ ls
action comedy drama genres.txt
$ ls historical
ls: cannot access ‘historical’: No such file or directory
$ ls historical
ls: cannot access ‘historical’: No such file or directory
$ ls historical/
ls: cannot access ‘historical/’: No such file or directory
$ pwd
/home/ccuser/workspace/movies
$ ls drama/historical/
cleopatra.txt gladiator.txt notorious.txt ray.txt selma.txt
$

I believe that is correct right

At step 1: “Note that we’re back in the movies/ directory again.”
No, we’re not. We’re still in drama/. I’m not a programmer, but it seems like these kinds of oversights shouldn’t be hard to avoid.

Can someone please give me a straight answer for this, I would really appreciate it. Before you judge me that I didn’t try, believe me that I have been trying for the past 3 hours.

I got this cleopatra.txt gladiator.txt notorious.txt ray.txt selma.txt but still saying it’s incorrect :frowning:

Many of these tests match against your input rather than the output returned, it’s not ideal but it’s the way it’s currently set up. What that means is that you’ll always want to be in exactly the directory cc expects you to be.

So make sure you’re in the movies/ directory then it’s a case of using ls with the path provided in the hint

Thank you! I been stucked for 1hr!

I have been here for over 2 hours . I read all of the above and still not working .I evan reset a few times and still not working . Anyone with the solution please help.

I just copied and paste this and it worked . don’t k ow why and how but I’m moving on . thanks much

It works great . Thanks so much.