Search code examples
bashcronspotify

Cleaning Spotify cache with crontab


Spotify caches a lot of data (multiple GBs) so that it can more quickly load songs you've already played. This is pretty useless given the cost.
I've tried to clean the cache with crontab but it never seems to work for me. I've tried the following two commands:

0 5 * * * rm -rf "~/.cache/spotify/Data/*" >/dev/null 2>&1
0 5 * * * /bin/bash -c "rm -rf ~/.cache/spotify/Data/*"

Solution

  • What you expected (don't use quotes around tilde ~ and * ) :

    0 5 * * * /bin/rm -rf ~/.cache/spotify/Data/* >/dev/null 2>&1
    

    Also, avoid to swipe to allow downloading songs if you don't want to, in Spotify UI