Add rm to find statement

I have the following script for a HandBrake folder

find "$TRANSCODEDIR"/* -type f -exec bash -c 'HandBrakeCLI -i "$1" -o "${1%\.*}".mp4 --preset="$PRESET"' __ {} \;

I want to add the rm (remove) command at the end of this line so that Hanbrake finishes with the file to remove it.

+3
source share
2 answers

You can pass more than one -exec switch to find how about:

find "$TRANSCODEDIR"/* -type f -exec bash -c 'HandBrakeCLI -i "$1" -o "${1%.*}".mp4 --preset="$PRESET"' __ {} \; -exec rm {} \;
+4
source
find .... -exec bash -c 'HandBrake .... --preset="$PRESET"; rm "$1"' __ {} \;
+1
source

All Articles