Add scripts/cleanup-music.sh
This commit is contained in:
parent
03d1fd28da
commit
f5c51c712a
23
scripts/cleanup-music.sh
Executable file
23
scripts/cleanup-music.sh
Executable file
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# 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
|
||||
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"
|
||||
|
||||
# Remove empty directories in two passes
|
||||
find "$HOME/music" -maxdepth 2 -type d -empty -delete
|
||||
find "$HOME/music" -maxdepth 1 -type d -empty -delete
|
|
@ -1,6 +1,6 @@
|
|||
# Loaded at the end of the initialization process
|
||||
|
||||
export PATH="$DOTFILES/bin:$HOME/bin:$PATH"
|
||||
export PATH="$DOTFILES/bin:$DOTFILES/scripts:$HOME/bin:$PATH"
|
||||
|
||||
#
|
||||
export EDITOR=$(is-callable nvim && echo 'nvim' || echo 'vim')
|
||||
|
|
Loading…
Reference in a new issue