All pastes #2097962 Raw Edit

Someone

public text v1 · immutable
#2097962 ·published 2012-01-01 14:38 UTC
rendered paste body
#! /bin/bash
#looks for m4v extension and, if found, looks for file with the same name ending in mkv, and if found, deletes the mkv

for NAME in `find "$1" -type d`/*; do
        echo "Processing: " "$NAME" 
        filename=$(basename "$NAME")
        extension=${filename##*.}
        filename=${filename%.*}
        #echo "Extension is: " "$extension"
        #echo "Filename is: " "$filename"
        if [ "$extension" = "m4v" ]; then
                #echo "Inside if"
                echo "Filename is still: " "$filename" and combined it is "$filename"".mkv" 
                echo "DELETING " 
                find "$1" -name "$filename" -exec rm  {} \;
        fi
done
~