Page 1 of 1

[Fixed]Whats wrong with this ?

Posted: 02 Apr 2012 13:35
by mazius123
even if the folder exist its create new one and moves the file ???

Code: Select all

@echo off
Title ImperialCraft 0.4.3 server by mazius123; %time%;
echo Startuojamas serveris ImperialCraft 0.4.3 (%~nx0 )
if exist {..\System_folder} (
    goto Paleisti_bukkit
) else (
    goto Sukurti_aplanka
)

:Sukurti_aplanka
if not exist Advanced_files mkdir Advanced_files
if not exist System_folder mkdir System_folder
move %~nx0 System_folder/
pause

Re: Whats wrong with this ?

Posted: 02 Apr 2012 14:11
by abc0502
Try this:

Code: Select all

@echo off
Title ImperialCraft 0.4.3 server by mazius123; %time%;
echo Startuojamas serveris ImperialCraft 0.4.3 (%~nx0 )
if exist {..\System_folder} (
    goto Paleisti_bukkit
) else (
    goto Sukurti_aplanka
)

:Sukurti_aplanka
if not exist Advanced_files ( mkdir Advanced_files
) Else ( goto next )
:next
if not exist System_folder ( mkdir System_folder
) Else ( goto next2 )
:next2
move %~nx0 System_folder/
pause

I added Else and :next and :next2
look at the code

Re: Whats wrong with this ?

Posted: 02 Apr 2012 14:27
by aGerman
mazius123 wrote:if exist {..\System_folder} (

What are the braces good for? This way it is looking for a folder "{.." in the current directory with a sub folder or file "System_folder}" in it.
If you would remove the braces (just "..\System_folder") it would look for a folder or file "System_folder" in the parent folder of the current directory.

How should your folder structure look like?

Regards
aGerman

Re: Whats wrong with this ?

Posted: 02 Apr 2012 14:35
by abc0502
I didn't notice the braces at all aGerman right there is no use of braces {
in "IF" command put the distination folder between "" like aGerman said

Re: Whats wrong with this ?

Posted: 03 Apr 2012 04:01
by mazius123
Thanx to you guys, you're the best. :D