Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Append rm to a find statement

I Have the following script to HandBrake a folder

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

I want to be append to the end of this line a rm (remove) command so when Hanbrake is done with the file to delete it.

like image 559
Constandinos Avatar asked May 07 '26 22:05

Constandinos


1 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 {} \;
like image 169
seanhodges Avatar answered May 10 '26 12:05

seanhodges