Both of these CMD files execute the same commands, one is very verbose to explain what's happening, the 2nd is stripped down to just the active commands.
In either case,
1. Choose the one you want to use.
2. Copy the contents to your text editor of choice,
3. Save the file to the main MQ folder with either a .BAT or .CMD extension,
4. Run that file with the Right-Click option to "Run As Administrator".
As embedded here today on 8/6/2022, the batch will delete any basic MQ log files in your main MQ folder that are more than 30 days old. It does NOT delete log files created by other plugin or macro files.
It will delete those files in the format of:
and
and
The verbose version:
And then here is the version without comments...
In either case,
1. Choose the one you want to use.
2. Copy the contents to your text editor of choice,
3. Save the file to the main MQ folder with either a .BAT or .CMD extension,
4. Run that file with the Right-Click option to "Run As Administrator".
As embedded here today on 8/6/2022, the batch will delete any basic MQ log files in your main MQ folder that are more than 30 days old. It does NOT delete log files created by other plugin or macro files.
It will delete those files in the format of:
MacroQuest-Launcher-20220723T140840.217574Z.log
and
MacroQuest-20220806T171632.718362Z.log
and
045bc468-30f6-482f-8d2c-0588e7734088.dmp
The verbose version:
clean_verbose.cmd:
@echo off
rem clean_logs.cmd by Bigdaddy on 8/6/22 to clean up old MQ log files!
rem
rem Place this file in the base MQ folder where Macroquest.exe lives!
rem
rem Then navigate to that folder using File Explorer and...
rem
rem Right-click on this file and Run As Administrator!
rem
@echo This batch file will clean up base Macroquest logs older than 30 days...
@echo.
@echo.
@echo It doesn't touch plugin or macro-specific log files.
@echo.
@echo.
@echo CTRL+C or CTRL+BREAK to abort at any pause!
@echo.
@echo.
@echo (compliments of BigDaddy August 6, 2022)
@echo.
@echo.
pause
rem First we change to current directory from which we are executing the Batch file...
@echo.
@echo Changing to the current directory...
cd /d %~dp0
rem Then we change to the log folder and display the contents...
@echo.
@echo Changing to the logs directory...
cd logs
@echo.
dir
pause
rem Now we take ownership of all files in the folder
@echo.
@echo Taking ownership of all files...
%windir%\System32\takeown /f *.* /r /d Y
pause
rem Now we ensure we have persmissions to delete files
@echo.
@echo Taking permissions of all files...
%windir%\System32\icacls *.* /t /c /grant Users:F
pause
rem Now we iterate the common MacroQuest log files and delete the ones older than 30 days
rem Can adjust the days by changing the -30 to something else!
@echo.
@echo Deleting older files...
%windir%\System32\forfiles.exe -m MacroQuest-*.log -d -30 -c "cmd /c del /q /f @path"
rem Then we display the folder again
@echo.
@echo Showing the directory after the deletions...
dir
pause
rem now we CD to where the Dumps are saved
@echo.
@echo Chaning to where the Dump files are stored...
cd Dumps\Reports
@echo.
@echo and we display the current list of files...
dir
pause
rem And we iterate the common Dumps files and delete the ones older than 30 days
@echo.
@echo Now we delete the older dump files...
%windir%\System32\forfiles.exe -m *.dmp -d -30 -c "cmd /c del /q /f @path"
@echo.
@echo and display the folder after the deletions!
dir
pause
rem Now we are done!
@echo.
@echo.
@echo We are done cleaning!
@echo.
@echo.
pause
And then here is the version without comments...
Clean.cmd:
cd /d %~dp0
cd logs
%windir%\System32\takeown /f *.* /r /d Y
%windir%\System32\icacls *.* /t /c /grant Users:F
%windir%\System32\forfiles.exe -m MacroQuest-*.log -d -30 -c "cmd /c del /q /f @path"
cd Dumps\Reports
%windir%\System32\forfiles.exe -m *.dmp -d -30 -c "cmd /c del /q /f @path"