Could not find a path

In powershell I created a dicrectory which is as follows-

New-Item - Path “c:” -Name “NAME\tests\docs” -ItemType “directory”

It worked.

After that I typed-

new-item -type file NAME/init.py

This one also worked.

After that I typed the following-

new-item -type file tests/init.py

But the result of the above text is- Could not find a part of the path

This is related to ex46.
Please help

Hi @amisha12

Does it works if you type:

new-item -type file NAME/tests/ __init__ .py 

?

I can just guess you did this from a directory above NAME and missed to include NAME.
If you actually was inside NAME, what you typed should work.

I am not used to Powershell. But I think this is the problem.

No it does not work. It is still showing the same thing that Could not find a part of the path

Hi @amisha12

It seems that Powershell has at least some commands that are the same as in a linux terminal.

pwd

This command tell you where you are.

ls

This tell you which files and folder you have where you are at the moment.

ls .\subfolder\another_folder

That command tell you what you have in “another_folder”

Do not create directly under the C folder!
Keep away from that folder as much as possible.
I would suggest you create a folder for these exercises.

C:\Documents\my_python_folder\exercises

The first thing you have to do is make sure you are in the correct folder.
When you have “cd” to your folder for exercise you can start create folders and files as needed.

Have a look at this link

Hey amish, I noticed in another question that you think you can only use new-item. Here’s me using mkdir:

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

PS C:\Users\Zed> mkdir test1,test2,test3


    Directory: C:\Users\Zed


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----       10/20/2019  12:27 PM                test1
d-----       10/20/2019  12:27 PM                test2
d-----       10/20/2019  12:27 PM                test3


PS C:\Users\Zed> rmdir test1,test2,test3
PS C:\Users\Zed>
A free service run by Zed A. Shaw for learncodethehardway.org.