I have tried to use shutil
, but rather than deleting the contents of the folder it just deletes the whole folder.
def delete_song():
print("Deleting song")
shutil.rmtree('./song_downloads')
print("Deleted song")
However it didn't print out "Deleted song". I also tried to use os.remove()
def delete_song():
print("Deleting song")
for file in os.listdir('./song_downloads'):
os.remove(file)
print("Deleted file")
But this didn't seem to work. Thanks