[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Move function in cmd

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 19
Thread images: 4

So I have been using this command to move files between directories, but I have faced some issues with it in the past.
I tried once to move one of the files to a folder that is not created, and what I got is a message says that the file is moved.
The problem is when I go to locate my file, I can't find it any more, and instead of the folder I get a new file with the folder name that I typed in the move command, and I am unable to open it, and I assume that my file is inside this new file as the size of my file is the same as this new one.
So is it a problem in Windows? Or can I even return my file back.
I think it should give an error from the start that the system can't find the destination folder.
>>
>>61757532
>I tried once to move one of the files to a folder that is not created, and what I got is a message says that the file is moved.
No what you got was a message saying it couldn't be moved

>I think it should give an error from the start that the system can't find the destination folder.
It does, you're just illiterate, pic related.
>>
File: 11.png (17KB, 749x357px) Image search: [Google]
11.png
17KB, 749x357px
>>61757707
123.txt is a text file that was created on the desktop.
After typing the move command to a folder that has not been created, the system creates a new file that can't be opened.
And I already tried the same thing in XP.
>>
>>61758684
All you did there was rename 123.txt to Test

It can be opened, you were just retarded and didnt give it a dot 3 extension so it doesnt know what program to open it with. You either manually choose a program to open it with or give it a dot 3 extension like .txt
>>
>>61758735
So what will happen when you create a batch file and move more than one file at once to the folder that is not created?
Do you think what you say will work when all of the files are moved to this one file that can't be opened?
>>
>>61757532
you mean mv?
oh you're using windows cmd ouch
>>
>>61758781
>So what will happen when you create a batch file and move more than one file at once to the folder that is not created?
It will tell you that the directory doesnt exist. But thats not what you're doing. You're moving it to a new file like a retard. try

move 123.txt c:\asdf\asdf\asdf.txt

and you'll see that it gives you the error you're expecting. If you write a batch file to do what you're presently doing after it renames the first file it will either prompt you to overwrite the first file with the second, or just error out complaining that the file already exists.

And why are you even writing batch files. Use PowerShell instead.
>>
>>61758831
>move 123.txt c:\asdf\asdf\asdf.txt

What do you mean by this?
You should move the 123.txt to another folder not to another .txt file.
And if you tried what I typed in op while making sure that the folder is already created, you will make sure that it moves the file not rename it.
>>
>>61758985
>You should move the 123.txt to another folder not to another .txt file.
Look retard, it is moving the file in to a directory which doesn't exist. What you name the destination file is irrelevant.

Anyways i'm going to sleep, please kill yourself since you dont even understand the most basic of DOS commands. And give up on trying to learn a 30 year old operating system as well, Microsoft will kill it off soon and anything you figure out will be useless.
>>
>>61758985
You need to define the destination filename also,not just the folder.

move 123.txt folder
vs
move 123.txt folder/123.txt
>>
>>61759041
Technically no he doesn't. If the directory exists it will move it in to the directory, otherwise it will just rename the file. Although specifying the file name will give him the error he is looking for.
>>
>>61759063
Well, true. It's also good practice to check whether the path exists in the first place with batch scripts.
>>
You guys are forgetting the \ at the end of the path to define the folder

E.g c:\asdf\asdf is a file
C:\asdf\asdf\ is a folder
>>
File: shot0057.jpg (52KB, 640x480px) Image search: [Google]
shot0057.jpg
52KB, 640x480px
I think I just got autism from reading this thread. Thanks guys
>>
>>61759063
So what will happen when you move 1000 files together to that same destination?
>>
>>61759657
I mean to the destination folder that does not exist.
>>
>>61757532
>>61758781
If you're working with scripts (be it Windows batch files or bash scripts or whatever), you'll have to delve deeper into conditional statements that'll check if the target destination already "exists" before attempting to do the command, and then either 1) create the folder first, then move, or 2) throw an error message and stop.

The solution is just a google search away.

Though one piece of advice: If you're telling the system to move file "a" to location "b" using some syntax like
move a C:\Path\To\b
, you'd do well do change this to
move a C:\Path\To\b\.
for increased security. If "b" doesn't exist in the first example, the system will assume you intended to rename the file to "b", whereas in the second it makes no such assumption, since it then "knows" that "b" should be a folder that can contain the file, and will throw an error if it can't. The single ".", in linux refers to "this directory", but I think it should be working the same in Windows.
>>
>>61759670
All but the last file will be overwritten by the last file. A very dangerous move to make, and highlights one of the biggest pitfalls when working with automated scripts. It's on the same level as an uninstall script running
sudo rm -rf /usr/ bumblebee
>>
>>61760054
Kek I remember that

>sorry guys i made a huge mistake
Thread posts: 19
Thread images: 4


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.