The next task I’m having for you—maybe we can clear it out again, and we start fresh again. So the next task I have for you is to copy the
hello_terminal.py file into a subdirectory. Let’s name it
It should still be present in your current directory but also copied into this
hello/ directory. Yes.
So as you may have seen in some of the others we did here, these commands tend to have very short names. So copy is shortened down to just being
cp. And with this one, let’s say we had the
hello_terminal, and then I want to copy this file.
00:39 So then I need two arguments to it, essentially saying where do I want to copy it as well. So if I just run this, you can see that it’s giving me an error saying that it also needs a destination file. Now you’re actually asking me to copy it into a directory, and that means that we need to have a directory to copy it into.
So before doing the copying, I’ll create that directory. So this is the same as we did earlier. We do the
mkdir, and now we can see if I do
ls, we have this one—it has a slightly different color because it’s a directory—and then we have our two files over here.
Once I have this directory, I can then copy the
hello_terminal, and then I also want to say where do I want to copy it, and if I just say
hello like this,
01:27 at least it’s not yelling at us. So that’s promising. And as long as it’s copying into a directory, it’ll just take the same filename and put that one into the directory.
So we can go with the
cd (change directory), which you also saw earlier, and have a look inside of here. And we can see that we have just now the
hello_terminal file that was copied from the one that’s in the directory above. Perfect.
So if you would have decided to rename the file in there, you could also have written
hello_newname.py and rename it in this go or— Yes, exactly. So if we started from this, I could add a
02:13 Okay. Yeah. And this will then give it in different name inside of the directory. Okay. So yeah, go ahead. Why not? We don’t have to hold back on creating new Python files. Right.
Nice. Okay, wonderful. So now we have two files in there, a
different_name.py one and the
Become a Member to join the conversation.