how to clean up GM's mess (automatically)

Tthecreator

Your Creator!
After being placed in multiple places here it finally is: (for good hopefully)
GM Version: GM:S 1.4.x
Target: Windows
Download: N/A
Links: https://drive.google.com/open?id=0B55RKkBYApL1eEZRRHc3bl9Eclk
https://drive.google.com/open?id=0B55RKkBYApL1QzNpWlllRmVzdkU

Summary:

Let's start with the purpose of this "tutorial" (if you could call it that). I personally own a rather small ssd as system drive and I think it's very annoying if windows update can't do its job just because my appdata is full of game maker temp files and folders up to a few gigabytes. That's why I've decided to make a little bat script with steps to program your system to automatically clean up the mess after you when you, for example, startup your computer.

This is meant for people who have similar problems with game maker. To check if this is a problem for you take the following steps:
1. Press your "windows key"+R to open up the run window.
2. type "%localappdata%" (without quotes) into the run window.
3. Select all folders starting with "gm_ttt_"
4. Right click on them and click "Properties"
5. If the size is these folders is significant to you (let's say a few gigs) then this is a problem, and you might want to consider using these scripts.


Tutorial:

First of all the script(s):

https://drive.google.com/open?id=0B55RKkBYApL1eEZRRHc3bl9Eclk

gmdel.bat:
Code:
echo off
for  /f "delims=" %%a in ('dir /b /a:d "%localappdata%" ^|findstr /i "gm_ttt_"') do (

  @echo Deleting "%localappdata%\%%~a"

rd /q /s "%localappdata%\%%~a"

)
I've also made a script automatically installs into your startup folder. That's given here:


https://drive.google.com/open?id=0B55RKkBYApL1QzNpWlllRmVzdkU

insertgmdel.bat (the original gmdel.bat script is included within this script an not needed seperately)
Code:
@echo off
REM remove file if already there
del gmdel2.bat
REM create file to copy over
@echo @echo off >> gmdel2.bat
@echo for  /f "delims=" %%a in ('dir /b /a:d "%localappdata%" ^|findstr /i "gm_ttt_"') do ( >> gmdel2.bat
@echo   @echo Deleting "%localappdata%\%%~a" >> gmdel2.bat
@echo rd /q /s "%localappdata%\%%~a" >> gmdel2.bat
@echo ) >> gmdel2.bat
REM copy file to startup
copy gmdel2.bat "C:\Users\%username%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"
REM remove traces
del gmdel2.bat
REM we are done now
@echo this script succesfully put setup the gmdelete script for startup at "C:\Users\%username%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"

Note that I'm not a .bat msdos/windows command/shell expert so it might not be perfect, but one can come very far with just google. If you have any suggestions please tell me. If you want to make sure that this will not mess up your system, then please wait if someone with actual knowledge has reviewed my code. Let that also be my disclaimer. I'm not responsible for any damage, lost save games, or any other data loss or corruption. Look at the script with a critical eye and your own and the Internets knowledge. This guide will also instruct you to change some system settings, so please be extremely careful, and don't continue when any errors pop up, things are different on your screen then on mine or if you plainly don't trust it.


In short this will delete all folders containing a "gm_ttt_" in it, inside your local appdata folder. Not your dedicated game folder, but this is the place your included files get extracted. (they don't get cleaned up and that's my problem.)


Now how to make this run every startup. (It doesn't work for shutdown, I've tried)
Method 1, using my startup script. (easy)
1. Download the following script: https://drive.google.com/open?id=0B55RKkBYApL1QzNpWlllRmVzdkU
2. Inspect that you indeed downloaded the right script by right clicking on the file and clicking on edit. Inspect the file.
3. When you are at the folder location of your script, shift+right click on a empty space in that folder. Then click on "Open command window here". Type in "insertgmdel.bat".
3. Run the script. (admin shouldn't be needed, but if the script doesn't work then please run it as admin.)
Method 2, manually putting the script in your startup folder. (still fairly easy)
1. Download the following script: https://drive.google.com/open?id=0B55RKkBYApL1eEZRRHc3bl9Eclk
2. Inspect that you indeed downloaded the right script by right clicking on the file and clicking on edit. Inspect the file.
3. On your keyboard, press the "windows flag key", while simultaneously pressing the R key. (the windows key is most often between the control and alt keys.)
4. Type into the box "shell:startup" (without quotes)
5. Copy the downloaded script into this location.
 
N

NPT

Guest
It's a poorly written attempt to remove temporary files created, but not deleted by Studio, and it doesn't work.

When running games Studio creates temporary files in a directory called gm_ttt_nnnnn where nnnnn is a random number. These directories are locatd in the appdata\local\temp folder. The batch file doesn't work because he's referring to the diretory %appdata% and not %appdata%\temp or %temp%. Therefore nothing is deleted because Studio doesn't put its files there.

The second batch file is a batch that creates the first batch file in your Startup folder so it runs upon login.

It's a bad idea because:
  • it doesn't work
  • Studio should be cleaning up after itself, and if it isn't than you should be finding out why Studio isn't and fix that
  • It's a bad idea to take somebody elses code, that deletes files and just sticking in on your system and running it.
 
Last edited by a moderator:

Tthecreator

Your Creator!
@NPT it's poorly written yes, making bat files is not really a thing I do often at all. If you would have any improvements please share them.
And yea it's quite stupid gm doest clean up these files.
And third: it's quite weird since my gm temp files DO get created in the %appdata% folder.
When I get home I'll look into creating more scripts for different paths.
 
N

NPT

Guest
And third: it's quite weird since my gm temp files DO get created in the %appdata% folder.
Because you have changed the default location in preferences.

Which happens to have a button to clear any leftover data.
 

Tthecreator

Your Creator!
@NPT I just checked and did see the input field and button, but never actually changed any of those fields. For me it really says Local Appdata, which is rather weird.

Also, yes the clear button does the same but having it done automatically is also useful.

One weird thing I noticed is that "Automatically clean Temp Data on Shutdown" was turned off (not by me). I will check it, disable my script then it should work.
 

Lukan

Gay Wizard Freak
Actually, GM: S creates my temp folders in %appdata% as well, it always has...
It creates my games' actual data in %localappdata% but the temps are made in %appdata%.
 
R

renex

Guest
What I do is just

upload_2017-2-5_0-14-18.png

so I just clean this up every now and then. Biggest I've ever seen this get was about 1GB / 10k files and that isn't even that much.
 
Top