diff --git a/shell/mpd/bin/cleanup-music b/shell/mpd/bin/cleanup-music index f1148b79..27261f64 100755 --- a/shell/mpd/bin/cleanup-music +++ b/shell/mpd/bin/cleanup-music @@ -3,7 +3,9 @@ # Delete all songs that are in the delete-pls playlist, and cleans up any empty folders # it leaves behind. -playlistfile=$HOME/music/.playlists/delete-pls.m3u +set -e + +playlistfile=$HOME/music/.db/playlists/delete-pls.m3u songs=$(<"$playlistfile") # Delete designated songs @@ -18,6 +20,5 @@ for song in ${songs[@]}; do done :>"$playlistfile" -# Remove empty directories in two passes -find "$HOME/music" -maxdepth 2 -type d -empty -delete -find "$HOME/music" -maxdepth 1 -type d -empty -delete +# Remove empty directories +find "$HOME/music" -type d -empty -delete