Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Having trouble with a certain script in batch!

Options
  • 23-12-2013 2:15pm
    #1
    Registered Users Posts: 15


    I'm making an application with Batch (I know XD) that backs up a certain file.
    I'm stuck where the app does this;
    If the directory doesn't exist, make it
    If any other files in the first directory exists, delete them
    Make a directory in the first directory.

    But I can't quite get it right.
    Here's What I'm doing:

    :setScript1
    cls
    echo.
    echo
    echo.
    echo Minecraft Batch Back-Up - V0.7.4.1 Alpha
    echo.
    echo
    echo.
    echo.
    echo MC Batch Back-Up Is Setting Up The Nessecary Enviroment(s)...

    IF not exist dir "C:\%UserName%\Desktop\Minecraft_Back-Ups\" mkdir "C:\%UserName%\Desktop\Minecraft_Back-Ups\"
    IF exist dir "C:\%UserName%\Desktop\Minecraft_Back-Ups\*" rmdir "C:\%UserName%\Desktop\Minecraft_Back-Ups\*"
    mkdir "C:\%UserName%\Desktop\Minecraft_Back-Ups\%date%_%time%"
    pause

    Anyone with Batch expertise please help!


Comments

  • Registered Users Posts: 7,501 ✭✭✭BrokenArrows


    You dont need the * in the rmdir lines.

    You needthe /s parameter on rmdir to delete subfiles and folders


  • Registered Users Posts: 15 SherRao


    You dont need the * in the rmdir lines.

    You needthe /s parameter on rmdir to delete subfiles and folders

    How would I write the line?
    'Cause I don't know what the 'S' Param is


  • Registered Users Posts: 6,501 ✭✭✭daymobrew


    SherRao wrote: »
    How would I write the line?
    'Cause I don't know what the 'S' Param is
    I guess:
    rmdir /s "C:\%UserName%\Desktop\Minecraft_Back-Ups\*"
    


Advertisement