0

I am aware that Spotify downloads songs and keeps them on my hard disk rather than keep re-streaming them. However, my Spotify cache is now up to 11gb and I’d like to use crontab to delete it.

I found this post here from 2018: Why is the Spotify cache so large? and used the commands within in crontab to schedule it to delete but it no longer works.

Has something changed since this original post meaning I need to use a different command in macOS Catalina?

Giacomo1968
  • 53,069
  • 19
  • 162
  • 212
  • 1
    `... it no longer works.` How does it not work? Errors? Crash? Deletion of other folders? – Saaru Lindestøkke Jul 16 '20 at 14:40
  • Have you tried running `rm "Library/Caches/com.spotify.client"` manually? What about changing it to `rm -f "Library/Caches/com.spotify.client"`? Or heck, what about looking for the file yourself by running a simple `ls -la Library/Caches/` and see if there is a Spotify file there? – Giacomo1968 Jul 16 '20 at 15:09
  • The cron job doesn't delete anything @SaaruLindestøkke – hardtofin Jul 16 '20 at 15:38
  • All of those commands just return "is a directory" @JakeGould – hardtofin Jul 16 '20 at 15:38
  • Try `rm -rf "Library/Caches/com.spotify.client` and see what happens. If it’s a directory you need the `-r` flag to tell `rm` to be recursive for directory deletions. – Giacomo1968 Jul 16 '20 at 16:42
  • Thanks for this @JakeGould. I am trying this command just from Terminal, not using Cron. This command appears to run without any problems, but the directory still remains and isn't deleted. How strange? – hardtofin Jul 16 '20 at 19:06
  • When i run ls -la Library/Caches/ i can see the folder, and next to it it has what i believe are the read write permissions. It shows "drwx------" where as all the other folders show "drwxr-xr-x". Is this possibly the problem? – hardtofin Jul 16 '20 at 19:15

1 Answers1

0

On MmacOS Catalina the com.spotify.client cache folder lives in ~/Library/Caches:

$ ls -lah ~/Library/Caches | grep com.spotify
drwx------    8 sl  staff   256B Jul 17 17:04 com.spotify.client
drwxr-xr-x    5 sl  staff   160B Mar 23 09:50 com.spotify.client.helper
drwxr-xr-x    5 sl  staff   160B Mar  6 19:24 com.spotify.installer

As you already saw, the com.spotify.client folder has read, write and execute permissions for the owner of the file (in this case sl). Users in the group (in this case staff) and other users have no permissions.

As you are (most likely) the owner of that folder you should be able to delete it.

To delete that folder once you would write in terminal:

rm -r ~/Library/Caches/com.spotify.client 

The -r flag recurses through the directory and is needed to delete folders.

If you want to run this command periodically you can refer to earlier questions on that subject.

Giacomo1968
  • 53,069
  • 19
  • 162
  • 212
Saaru Lindestøkke
  • 5,515
  • 8
  • 30
  • 48