Skip to content

Instantly share code, notes, and snippets.

@manpages
Created October 28, 2012 04:40
Show Gist options
  • Save manpages/3967538 to your computer and use it in GitHub Desktop.
Save manpages/3967538 to your computer and use it in GitHub Desktop.
Good script to watch temprorary files through and deciede whether you want to delete file or not.
#!/bin/bash
play() {
mplayer -fs $1
}
callback() {
local data=$1
rm -v "./$data"
}
main() {
local ext=$1
for x in *$ext; do
play $x
read -p "Are you sure? " -n 1 choice
echo
if [[ $choice =~ ^[Yy]$ ]]; then
callback $x
fi
done
}
# init()
if [$# -le 1]; then
echo "No extension supplied, falling back to .flv"
main 'flv'
else
main $1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment