BASH find Question

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
+ (text/plain)
Delete this message
Reply to this message
Author: Mark Phillips
Date:  
To: Main PLUG discussion list
Subject: BASH find Question
I found a few (~120) .mkv files crept into my plex movie drive. Plex on my
limited plex server has trouble transcoding these files in real time, so I
need to transcode them into mp4s ahead of time.

I tried this script, but I have an problem with the second find command.

find /media/plex/ -name '*.mkv' | while read line; do
    echo "Processing file '$line'"
    f=`basename "$line" .mkv`
    echo "basename = $f"
    if [ -n "$(find /media/plex/ -name '$f.mp4' )" ]; then
        #ffmpeg -i {} -vcodec copy -acodec copy $f.mp4 > fix2-mkv.txt 2>&1
        #echo {} > files_fixed.txt 2>$1
        echo "**************need to convert $line"
    else
        echo "$f.mp4 already exists"
    fi
done


All of the file names contain special characters, eg '[', and others.

For example,
/media/plex/Movies/Disney (Classic)/Robin Hood (1973 Movie)
[x264-AAC][DVD][C-W].mkv

I get a false negative on this file when I search for the corresponding mp4
file because of the '[' in the file name.

This works:
find /media/plex -name 'Robin Hood (1973 Movie)*'
/media/plex/Movies/Disney (Classic)/Robin Hood (1973 Movie)
[x264-AAC][DVD][C-W].mkv

but this gives a false negative
find /media/plex -name 'Robin Hood (1973 Movie) [x264-AAC]*'
root@orca:/home/mark#

I searched the find man page for ways to handle the special characters, but
no luck on finding a solution. Anyone have a suggestion?

Thanks!

Mark
---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss