Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Help with batch file  (Read 2181 times)

0 Members and 1 Guest are viewing this topic.

darkness1990

    Topic Starter


    Newbie

    • Experience: Beginner
    • OS: Windows 7
    Help with batch file
    « on: September 30, 2018, 01:27:30 AM »
    Hi, I've created a batch file to automatically do a backup of my server. I want to create folders with date and time and delete folders older then 3 days old when the batch is run. here is what I have so far. ATM its just dumping the .db files into d:\WurmTSR\TSR\Backups\sqlite no folders or dates-time also not deleting old backups. I'm not very good with coding..
    Code: [Select]
    ECHO OFF
    CD /D D:\WurmTSR\TSR\The Severed Realms\sqlite
    FOR /R %%F in (*.db) do (
        echo %%~nFz
        sqlite3 %%~nF ".backup 'd:\WurmTSR\TSR\Backups\sqlite\%%~nF'"

    )
    ECHO ON
    pause

    I also need to make a backup of the world files into the same folder but with a sub folder "world" with date and time this is what I'm using atm...

    Code: [Select]
    ECHO OFF
    xcopy /d /y /s "D:\WurmTSR\TSR\The Severed Realms\*.map" "D:\WurmTSR\TSR\backups\world"
    xcopy /d /y /s "D:\WurmTSR\TSR\The Severed Realms\*.bmap" "D:\WurmTSR\TSR\backups\world"
    ECHO ON
    Pause

    So hypothetically I would like to run both these codes in the same batch and have it take a copy of all the files and put them in D:\WurmTSR\TSR\backups with folder name eg backup_30-09-2018-6pm inside of that have a folder sqlite and one called world. the .db files go inside of "sqlite" and the .map files go inside "world" and any backup_date folders older then 3 days are deleted. Would also be great if it could automatically zip the folders to save space until they are deleted.. :P
    « Last Edit: September 30, 2018, 01:42:55 AM by darkness1990 »