Skip to content

Instantly share code, notes, and snippets.

@SammysHP
Created September 7, 2015 17:48
Show Gist options
  • Select an option

  • Save SammysHP/a7af929b4aea043b717d to your computer and use it in GitHub Desktop.

Select an option

Save SammysHP/a7af929b4aea043b717d to your computer and use it in GitHub Desktop.
#!/bin/bash
EXTENSION_RAW="ARW"
filelist=$(sxiv -o "$@")
if [[ -z $filelist ]]; then
exit
fi
IFS=$'\n'
echo "Files to be removed:"
echo
for filename in $filelist; do
absname=$(realpath "$filename")
rawname="${absname::-3}$EXTENSION_RAW"
echo "rm '$absname'"
echo "rm '$rawname'"
done
echo
read -p "Really delete these files? (y/N): " -r
if [[ $REPLY =~ ^[YyJj]$ ]]; then
echo
echo "Deleting files..."
for filename in $filelist; do
absname=$(realpath "$filename")
rawname="${absname::-3}$EXTENSION_RAW"
rm -v "$absname"
rm -v "$rawname"
done
echo "done."
fi
unset IFS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment