Moving a File (mv) Appendix command crash line crash course

I have this error showing up on the powershell, and i dont understand why.
“mv : Cannot create a file when that file already exists.
At line:1 char:1”

Do I need to write like this:

mv awesome.txt
mv uncool.txt

or like this:

mv awesome.txt uncool.txt

Hello @Gang.

Read this article about the mv command.

mv command

Hello, thank you for the effort, but I use windows

Still its useful when using powershell.

Most of the commands can be typed the same as in Linux or Mac.
You can also type:

man mv

to get some help how to use the command.

Dont forget to do some exercises on each lesson. Both the study drills given by Zed and some extra on your own.
Its very very useful in the long run.

Hi ulfen69, when i see: mv awesome.txt uncool.txt
i need to look like a two line command? such as
mv awesome.txt
mv uncool.txt

and thank you for your help, now i see the compatibility between linux and windows

The mv command always takes two argument Gang. When you do this:

mv awesome.txt

It fails because you need a FROM and TO set of parameters:

mv FROM TO

So you need:

mv awesome.txt uncool.txt

Hello Zed, it keeps showing me an error.

mv : Cannot create a file when that file already exists.
At line:1 char:1
+ mv awesome.txt uncool.txt
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (C:\Users\username\temp\awesome.txt:FileInfo) [Move-Item], IOException
    + FullyQualifiedErrorId : MoveFileInfoItemIOError,Microsoft.PowerShell.Commands.MoveItemCommand

Alright, so can you explain what that error means?

Also, when you do code do this:

[code]
# put your computer outputs and code here
[/code]

I did this for you by doing this:


[code]
mv : Cannot create a file when that file already exists.
At line:1 char:1
+ mv awesome.txt uncool.txt
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (C:\Users\username\temp\awesome.txt:FileInfo) [Move-Item], IOException
    + FullyQualifiedErrorId : MoveFileInfoItemIOError,Microsoft.PowerShell.Commands.MoveItemCommand
[/code]

Hello Zed, i do not know what the error means.
I’m still in ex03 in python and started doing the appendix in order to understand more the commands.

Sure you do:

“Cannot create a file”

First, it cannot create a file. Next:

“when that file”

It’s talking about the file you’re trying to create.

“already exists”

The file already exists.

Pretty simple. You tried to move a file and the place you tried to move it to already exists.

I suggest you keep an English dictionary site open and you lookup every word you don’t know when you’re going through this.

A free service run by Zed A. Shaw for learncodethehardway.org.