2016-12-23 00:10:40 -08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# Delete all songs that are in the delete-pls playlist, and cleans up any empty folders
|
|
|
|
# it leaves behind.
|
|
|
|
|
2016-12-28 23:39:21 -08:00
|
|
|
set -e
|
|
|
|
|
|
|
|
playlistfile=$HOME/music/.db/playlists/delete-pls.m3u
|
2016-12-23 00:10:40 -08:00
|
|
|
songs=$(<"$playlistfile")
|
|
|
|
|
|
|
|
# Delete designated songs
|
|
|
|
IFS="
|
|
|
|
"
|
|
|
|
for song in ${songs[@]}; do
|
|
|
|
fpath="$HOME/music/$song"
|
|
|
|
if [[ -f $fpath ]]; then
|
|
|
|
echo "Deleting: $song"
|
|
|
|
rm -f "$fpath"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
:>"$playlistfile"
|
|
|
|
|
2016-12-28 23:39:21 -08:00
|
|
|
# Remove empty directories
|
|
|
|
find "$HOME/music" -type d -empty -delete
|