If you like music, surely they use a streaming service to listen to it over the Internet. Platforms, such as Spotify, allow us to download and play the songs that we want to listen to easily from their program. These songs are saved as temporary or cache files on your computer. In this way, if we replay a song that we have listened to previously, instead of downloading it again, it will be loaded from the cache. However, if we use Spotify a lot, it is easy for this cache to take up too much space on our hard drive.
The biggest problem with Spotify is that it doesn’t give us much control over the cache files it downloads. The Windows client only allows us to change the location of these files, but nothing else. Therefore, it is easy to find that, after a while, this folder occupies up to 10 GB of space on the hard disk, since it seems that this is the maximum size established by the program.
We can always delete this folder by hand, although the truth is that it is counterproductive, especially considering that, if we use the UWP app, the path where this data is saved is not exactly by hand.
Having these 10 GB busy can always be annoying, especially if we have a relatively small hard drive or an SSD drive. Therefore, we are going to explain different tricks with which we will be able to automate the deletion of this folder so that it is emptied every day when we turn off the PC, or every so often without having to do anything else.
Delete the Spotify folder when shutting down the computer
In order to automate this task we need, first of all, to know where the Spotify cache files are stored. Next we will have to create a simple BAT script to execute it in CMD, and finally automate its execution when turning off the PC.
Check where Spotify temporary files are saved
Depending on the version of the client we have (installable, UWP, etc.), the cache will be saved in one directory or another. The process is the same for all of them, but you can change the path where this data is saved. We are going to follow the steps for the UWP version.
The default directories where this cache is kept are:
For the normal version (changing “user” by our username):
For the UWP (changing “user” by our username):
All the content inside these folders is the temporary, or cache, content of the program. And therefore we can eliminate it.
Create script to clean folder automatically
CMD has a command, RMDIR, that allows us to delete files or folders from the command prompt. So, we are going to create our own cleaning script to remove this cache and free up all the space that the music program has occupied during our last session.
To do this, we will open a notepad and write the command “rmdir” in it, followed by the corresponding path. At the end of the path we will add a * that will indicate to the command that we want to delete all the content that is inside said directory. In our case, the command is as follows (remember, we must change “ruvel” for our username:
rmdir /s /q "C:/Users/usuario/AppData/Local/Packages/SpotifyAB.SpotifyMusic_zpdnekdrzrea0/LocalCache/Spotify/Data/*"
We use the ” rmdir ” command because “del” is only valid for files. As Spotify stores its cache within other subfolders, with this command we delete them all.
After writing this command, the next step will be to save the text file as a .bat file . We will use the option « Save as «, we will add .bat at the end of the name of the file that we want to have, and we will choose the type «all files».
We already have the script created. We can test that it works by running it and checking if the Spotify temporary folder is deleted correctly. If it doesn’t, we have done something wrong.
If it works, now we only have to schedule its execution.
Schedule erasure of temps when turning off the PC
If we have Windows 10 Pro, we can schedule the execution of the script through group policies. To do this, what we must do is run gpedit.msc, and there we will go to the Computer Configuration section. Next we will have to go to Windows Settings, and double click on the Scripts option (Start / Shutdown) in the right panel.
Once here, we double click on « shutdown «, and what we will do next is to add the script that we want to be executed when we turn off the computer. That is, the one we just created.
We look for the script where we have saved it, load it and that’s it. We accept the changes and we will have the task automated. From now on, every time we turn off the computer, the script will run and delete all the temporary files generated by Spotify .
Use schedule to automatically delete folders
The above method has its limitations. For example, it doesn’t always work, and Windows 10 Home users can’t access group policies. Therefore, it is not a method that can be used for 100% of the people. In that case, there are other ways to do the same, although it involves using third-party programs to do it.
One of them is to use the Cyber-D’s Autodelete program . This completely free software allows us to automate the deletion of a folder under certain circumstances.
We can add the directory of the Spotify cache folder, and configure this program to automatically erase all the data that is more than a week old. Thus, we can automatically delete all the old cache from our hard drive. If we want to do it more frequently, we can choose up to hours and minutes.
We can download this program from this link .
Delete Files Older than
This program is broadly based on the same thing. We can assign to this program all the files or folders that we want to delete automatically after a certain number of days and, then, it will take care of deleting it. We can tell you that we want the data to be erased every day to free up more space, or to erase data that is older than a certain time. This way we will avoid having space occupied by junk data unnecessarily.
We can download this program from here .