A small script to clean up my downloads folder written in Clojure. Only works on Mac OS X.
The script will trash everything under ~/Downloads
that has not been opened for longer than a year.
To build the binary, here are some instructions.
- Install lein
- Download GraalVM for your machine. You will need the EE version.
- Set
JAVA_HOME
to the GraalVM home directory, e.g.
export JAVA_HOME=~/Downloads/graalvm-1.0.0-rc1/Contents/Home
- Set the
PATH
to use GraalVM's binaries, e.g.
export PATH=$PATH:~/Downloads/graalvm-1.0.0-rc1/Contents/Home/bin
- Create the uberjar:
lein uberjar
- Finally, create the binary:
native-image -jar target/trasher-0.1.0-SNAPSHOT-standalone.jar -H:Name="trasher"
Here is how to schedule a daily job for executing the binary.
-
Change the username, binary path and schedule in the
./ams.geurs.trasher.plist
file. -
Copy the file into
~/Library/LaunchAgents/
-
Load the job into launchd:
launchctl load ~/Library/LaunchAgents/ams.geurs.trasher.plist