Last active
September 13, 2019 20:04
-
-
Save eestrada/e531dd6d2a112b4f57b3875cb994aa29 to your computer and use it in GitHub Desktop.
The "Downloads" folder is a bloat trap for random files. Treat it like a temp directory and clean it every startup.
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
:: This is free and unencumbered software released into the public domain | |
:: using the Unlicense. Please refer to <http://unlicense.org/> | |
:: This script will completely delete and then recreate your "Downloads" and "Temp" folders in your home directory. | |
:: This should work for pretty much any NT based version of Windows. If you are still on Windows 9x for some reason, I am sorry. | |
:: Place this file in "%HOMEDRIVE%%HOMEPATH%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\cleantemp.cmd" | |
:: or similar to have it run automatically at startup. | |
:: If, like me, you like to have an explicit Temp directory in your home folder. If not, delete or comment this out. | |
rd /s /q %HOMEDRIVE%%HOMEPATH%\Temp | |
md %HOMEDRIVE%%HOMEPATH%\Temp | |
:: On some versions of Windows, this may delete your download folder's automatic special icon. | |
:: It is left as an exercise for the user to figure out how to deal with this. | |
rd /s /q %HOMEDRIVE%%HOMEPATH%\Downloads | |
md %HOMEDRIVE%%HOMEPATH%\Downloads |
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
# This is free and unencumbered software released into the public domain | |
# using the Unlicense. Please refer to <http://unlicense.org/> | |
# Works on FreeBSD. May work on other Unix work-alikes. YMMV depending on your cron scheduler software. | |
SHELL=/bin/sh | |
# HOME=/home/<your username> | |
PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin | |
LC_ALL="en_US.UTF-8" | |
LANG="en_US.UTF-8" | |
CHARSET="UTF-8" | |
# Order of crontab fields | |
# minute hour mday month wday command | |
# This assumes your cron scheduler supports special timing shortcuts like @reboot | |
@reboot cd ${HOME}/tmp/ && find . -delete | |
@reboot cd ${HOME}/Downloads/ && find . -delete |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment