I am new to python. I am currently learning the exercises on the appendix (exercise 12). I am really finding it difficult to write the right command to enable me to copy and view a file that I saved using notepad ++ as directed by the python tutors. It always gives an error like “access to this path is denied” or “Item with specified name already exists”. But I can’t execute the command “more test.txt” without seeing an error. I use a windows OS.
Hi @Ayorinde, most likely you are not in the right place, or do not know what’s there. So, remember the mantra you must burn into your brain:
After every move type
Copy a file? pwd ls
Move a file? pwd ls
Cd to a directory? pwd ls
Pwd ls? pwd ls
If you do that then you’ll be able to find the location of the file, and then map it to where you want it to go. Also, pay special attention to where you tell Notepad++ to save a file. Don’t just save it randomly, but actually tell notepad++ to save in the right place. How do you know what the right place is?
I’m having a similar problem. I know that my test.txt is saved in c:\users\admin and i want to move it to c:\users\temp
I have done pwd ls repeatedly
What I’m having trouble with is figure out how to move it from c:\users\admin to c:\users to c:\users\temp
I think in the previous exercises, we’ve just had to move files from one directory to a directory within the directory (so the file and the new directory were in the same original directory).
What is the output of: pwd ?
And: ls ?
When you write c:/users/admin it look like you have a Windows machine.
Does powershell have the same commands as unix?
I don’ t know anything about powershell.
In linux or Mac it would be ”cd admin” to get into that folder.
Inside I would list my files/folders with ”ls”.
”ls -la” for more details about them.
If I wanted to move a file I would do ”mv filename c/users/temp/filename” .
Or ”mv filename c/users/temp/new_name” if I would like to rename it.
Hope this help anything.
Hey @moofaltrades, As @ulfen69 said you need to use pwd and ls to make sure you’re in the right place, but if you’re using full paths make sure you’re doing:
mv c:\users\admin\test.xt c:\users\temp\
Now if you get an error that the file doesn’t exist then you need to go there and see if it’s really there:
If you see the file there, then you can do that mv command again. If it still doesn’t work then post the real error message.
Which brings me to one more little thing: When you ask for help make sure you paste in the actual error messages or put up a little screenshot. On windows you can use the Snipping Tool to do that. When you post code or error messages, wrap it like this:
I am an error message or code.
Then it’s a lot easier to help.
THank you! @zedshaw and @ulfen69