Page 1 of 1

Do you ever get subfolders?

Posted: April 21st, 2010, 9:58 pm
by randyharris
I always end up with this structure.

$DIR/[unpacked files]
possibly: $DIR/VIDEO_TS/[unpacked files]

Today I got this: $DIR/$DIR/VIDEO_TS/[unpacked files]

Does anybody run across this often? Wondering if (and how) I could modify my post processing script to maybe delve into sub directories if the target content isn't found in $DIR where it is expected.

Re: Do you ever get subfolders?

Posted: April 21st, 2010, 11:17 pm
by randyharris
Hmm, well I figured why not just figure it out and take care of it. So about 10 minutes of pondering and 10 minutes of googling and 15 minutes of testing, and now I'm set. The Bash script now starts in $DIR and searches recursively for VIDEO_TS.IFO (case insensitive search) and then performs the work on that sub directory, regardless of what it is called.

If it may be of interest, here's how I did it in BASH.

Code: Select all

#! /bin/bash
cd $DIR
if [[ -e $(find . -name VIDEO_TS.IFO) ]]; then
	found=$(find . -name VIDEO_TS.IFO)
	echo "folder/file: $found"
	folder=$(echo $found|sed 's/[vV][iI][dD][eE][oO][_][tT][sS][.][iI][fF][oO].*//g')
	folder2=$(echo $folder|sed 's/[vV][iI][dD][eE][oO][_][tT][sS].*//g')
	echo
	echo "This is the folder to use HDIUTIl to convert to ISO: $folder2"
	echo
	echo
	else
	echo "nada"
fi