Created
October 28, 2012 04:40
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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