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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Having trouble with a certain script in batch!

  • 23-12-2013 1: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,501 ✭✭✭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,571 ✭✭✭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