Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Having trouble with a certain script in batch!

  • 23-12-2013 02:15PM
    #1
    Registered Users, Registered Users 2 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, Registered Users 2 Posts: 7,544 ✭✭✭BrokenArrows


    You dont need the * in the rmdir lines.

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


  • Registered Users, Registered Users 2 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, Registered Users 2 Posts: 6,652 ✭✭✭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