Locked learning resources

Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Locked learning resources

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Renaming Files - Windows Terminal

00:00 We are back in the pb_terminal\ directory, and in there is a file named hello_terminal. And now I want you to rename this file into hello_world.

00:11 Okay, and I was just trying to think of the alias for that, but I can never remember the one for this one for some reason. I’m not sure if it even has one. But this one is quite verbose, rename-item, but it’s very descriptive of what it does.

00:27 And then you can pass in the path to the item that you want to rename, which is, in this case, hello_terminal, and then we can just give it its new name as the second argument to this command.

00:41 And the commands are separated by a space. And so if I press Enter now, I also get no output for this, but if I list it here, you’ll see that the file has now been renamed.

00:54 Okay. And the contents of the hello_world file are still the same, like before. It was print('Hello, Terminal!'). Okay, let’s check. I’ll use the cat command again, and yes, it is print ('Hello, Terminal!'). Okay, I also saw something happening there because you were pressing Tab, and since we now have a directory called hello and a file called hello_world, the tab alone doesn’t necessarily get you to the file. Right, yes, so if I was to say cat and then try and just put in, say, hello,

01:33 and then I tried to tab auto-complete, there’s two items in the directory as you say. One is the folder, and one is the file. And if I press Tab once, it’s going to think, Okay, there’s two. Here’s one. And this is the folder.

01:47 And you can tell it’s a folder, as well, by the training \ (slash). And if I just press Tab again, it will move on to the next potential suggestion.

01:57 And so yeah, I can just press Tab various times, and if I want to go back, I can press Shift + Tab, but it’s the same. I can just press Tab again and again, and since there are only two items that it can be, it just goes between them.

Become a Member to join the conversation.