~ / Library / LaunchAgents / me.lri.clear.desktop.and.documents.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>me.lri.clear.desktop.and.documents</string>
<key>ProgramArguments</key>
<array>
<string>osascript</string>
<string>-e</string>
<string>say "lol"</string>
<!-- <string>tell application "Finder"
move items of desktop to trash
move items of (path to documents folder) to trash
end tell</string> -->
</array>
<key>StartInterval</key>
<integer>5</integer> <!-- every 5 seconds -->
<!-- <key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>23</integer>
<key>Minute</key>
<integer>0</integer>
</dict> -->
</dict>
</plist>
O agente será carregado após sair e voltar, ou após executar launchctl load ~/Library/LaunchAgents/me.lri.clear.desktop_and.documents.plist
.
Veja man launchctl
e man launchd.plist
para mais informações.
Outra opção seria adicionar algo assim ao seu crontab:
0 0 0 * * osascript -e 'tell app "Finder"' -e 'move items of desktop to trash' -e 'move items of (path to documents folder) to trash' -e 'end'
(Você pode salvar isso como ~/.crontab
e, em seguida, executar crontab ~/.crontab
)