Last active
April 8, 2023 14:17
-
-
Save haymaker/dd2f693ea8935dba43a7ac67e4f02e7b to your computer and use it in GitHub Desktop.
Batch File to Clean SimBrief Downloads (requires configuration)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
:: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | |
:: This is a super duper simple no-logic batch file to remove simbrief downloaded files | |
:: after a configured amount of days. | |
:: | |
:: Configure the directories and options below, then set up a task in Windows Task | |
:: Scheduler that runs this script, usually once a day or so is sufficient. | |
:: | |
:: Also: Don't be dumb. Know what you're doing. You can delete important stuff if you're | |
:: not paying attention. Set things correctly, run things correctly, and profit. | |
:: | |
:: Use at your own risk. | |
:: | |
:: Please note: the forfiles commands below will get very angry and spew forth | |
:: monstrously repulsive vitriol at you if it doesn't find any files to run its | |
:: commands on. This is normal. Do not be (too) alarmed. Do not taunt happy fun ball. | |
:: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | |
:: ::::::::::::::::::::::::::::::: | |
:: SCRIPT CONFIGURATION | |
:: ::::::::::::::::::::::::::::::: | |
:: Find files older than this number of days (must be negative to look back in time) | |
:: Default is 5 days | |
set OLDERTHAN=-5 | |
:: ::::::::: PMDG 737 | |
:: Set this to your PMDG Directory | |
:: There Flightplans and Weather directories are listed separately | |
:: To disable one or the other, comment out the directory variable. | |
set ENABLE_PMDG737=true | |
set PMDG737=C:\ ~~YOUR PATH TO~~ \Microsoft Flight Simulator\Packages\pmdg-aircraft-737\work\Flightplans | |
set PMDG737WX=C:\ ~~YOUR PATH TO~~ \Microsoft Flight Simulator\Packages\pmdg-aircraft-737\work\WX | |
:: ::::::::: Leonardo Maddog MD-82 | |
:: MD82 has two directories, one for the aircraft, one for the Load Manager | |
:: To disable one or the other, comment out the directory variable. | |
set ENABLE_MD82=false | |
:: Load Manager directory | |
set MD82_LM=C:\ ~~YOUR PATH TO~~ \Maddog X Files\Routes | |
:: Aircraft directory | |
set MD82_AC=C:\ ~~YOUR PATH TO~~ \Microsoft Flight Simulator\Packages\Community\lsh-maddogx-aircraft\Routes | |
:: ::::::::: PDFs of Operational Flight Plans (OFPs) | |
:: This is for folks that use Simbrief Downloader to downloaded OFPs as well. | |
set ENABLE_OFP=true | |
set OFP=C:\ ~~YOUR PATH TO~~ \OFPs | |
:: ::::::::: Volanta Autosaves | |
:: Volanta can (and does) create a ton of autosave files if you happen to have | |
:: a subscription and use the autosave feature. To auto-remove those, set the | |
:: configuration options below. | |
set ENABLE_VOLANTA=false | |
set VOLANTASAVE_OLDERTHAN=-2 | |
set VOLANTASAVE_MSFS=C:\ ~~YOUR PATH TO~~ \Microsoft Flight Simulator | |
set VOLANTASAVE_PMDG=C:\ ~~YOUR PATH TO~~ \Microsoft Flight Simulator\Packages\pmdg-aircraft-737\work\PanelState | |
:: ::::::::::::::::::::::::::::::: | |
:: END SCRIPT CONFIGURATION | |
:: Don't change anything below | |
:: unless you know what you're | |
:: doing. :-) | |
:: ::::::::::::::::::::::::::::::: | |
echo Cleaning your chosen directories..... | |
IF "%ENABLE_PMDG737%"=="true" ( | |
:: Clean PMDG 737 directory | |
echo Cleaning Files for PMDG 737 | |
IF DEFINED PMDG737 ( | |
echo - Flight Plans | |
forfiles /P "%PMDG737%" /M *.rte /D %OLDERTHAN% /C "cmd /c del /q @path 2>nul" 2>nul | |
) | |
IF DEFINED PMDG737WX ( | |
echo - Weather | |
forfiles /P "%PMDG737WX%" /M *.wx /D %OLDERTHAN% /C "cmd /c del /q @path 2>nul" 2>nul | |
) | |
) | |
:: Clean Leonardo Maddog MD-82 directories | |
IF "%ENABLE_MD82%"=="true" ( | |
echo Cleaning files for MD82 | |
IF DEFINED MD82_LM ( | |
echo - Load Manager | |
forfiles /P "%MD82_LM%" /M *.mdr /D %OLDERTHAN% /C "cmd /c del /q @path 2>nul" 2>nul | |
forfiles /P "%MD82_LM%" /M *ACARS.txt /D %OLDERTHAN% /C "cmd /c del /q @path 2>nul" 2>nul | |
) | |
IF DEFINED MD82_AC ( | |
echo - Aircraft | |
forfiles /P "%MD82_AC%" /M *.mdr /D %OLDERTHAN% /C "cmd /c del /q @path 2>nul" 2>nul | |
forfiles /P "%MD82_AC%" /M *ACARS.txt /D %OLDERTHAN% /C "cmd /c del /q @path 2>nul" 2>nul | |
) | |
) | |
IF "%ENABLE_OFP%"=="true" ( | |
echo Cleaning OFPs | |
IF DEFINED OFP ( | |
:: Clean out the OFP PDF directory | |
forfiles /P "%OFP%" /M *.pdf /D %OLDERTHAN% /C "cmd /c del /q @path 2>nul" 2>nul | |
) | |
) | |
IF "%ENABLE_VOLANTA%"=="true" ( | |
echo Cleaning Volanta Saves | |
IF DEFINED VOLANTASAVE_MSFS ( | |
echo - MSFS Saves | |
forfiles /P "%VOLANTASAVE_MSFS%" /M "Volanta Save - *.FLT" /D %VOLANTASAVE_OLDERTHAN% /C "cmd /c del /q @path 2>nul" 2>nul | |
forfiles /P "%VOLANTASAVE_MSFS%" /M "Volanta Save - *.SPB" /D %VOLANTASAVE_OLDERTHAN% /C "cmd /c del /q @path 2>nul" 2>nul | |
) | |
IF DEFINED VOLANTASAVE_PMDG ( | |
echo - PMDG Saves | |
forfiles /P "%VOLANTASAVE_PMDG%" /M "Volanta Save - *.rte" /D %VOLANTASAVE_OLDERTHAN% /C "cmd /c del /q @path 2>nul" 2>nul | |
forfiles /P "%VOLANTASAVE_PMDG%" /M "Volanta Save - *.fmc" /D %VOLANTASAVE_OLDERTHAN% /C "cmd /c del /q @path 2>nul" 2>nul | |
forfiles /P "%VOLANTASAVE_PMDG%" /M "Volanta Save - *.sav" /D %VOLANTASAVE_OLDERTHAN% /C "cmd /c del /q @path 2>nul" 2>nul | |
) | |
) | |
echo Cleaning Complete. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment