I am creating a script called "convert_mkv_mp4_v3.sh"
#!/bin/bash
# If no directory is given, work in local dir
if [ "$1" = "" ]; then
DIR=.
else
DIR="$1"
fi
arrayname=()
while IFS= read -d '' -r filename; do
arrayname+=("$filename")
done < <(find ${DIR} -name '*.mkv' -print0)
printf "%s\n" "${arrayname[@]}"
When I run it with: convert_mkv_mp4_v3.sh ./U*
it prints 3 file names:
./U2 - Go Home Live from Slane Castle Ireland/title_t00.mkv
./U2 - Go Home Live from Slane Castle Ireland/Scenes/title_t01.mkv
./U2 - Go Home Live from Slane Castle Ireland/Scenes/title_t02.mkv
On the other hand, if I alter the following find ${DIR} -name '*.mkv' -print0
to find ./U* -name '*.mkv' -print0
I get:
./U2 - Go Home Live from Slane Castle Ireland/title_t00.mkv
./U2 - Go Home Live from Slane Castle Ireland/Scenes/title_t01.mkv
./U2 - Go Home Live from Slane Castle Ireland/Scenes/title_t02.mkv
./U2 - Live/U2 - Live - Germany 1983.mkv
./U2 - Rattle and Hum/title_t00.mkv
./U2 - The Best of 1990-2000/U2 - The Best of 1990-2000 - video.mkv
./U2 - The Best of 1990-2000/Scenes/U2 - The Best of 1990-2000 - extra.mkv
./U2 - The Joshua Tree/title_t00.mkv
./U2 - Vertigo 2006 - Sao Paulo/title_t00.mkv
./U2 - Zoo TV live from Sydney/title_t00.mkv
./Ultraje a Rigor - Acustico MTV/Scenes/title_t06.mkv
./Ultraje a Rigor - Acustico MTV/Scenes/title_t01.mkv
./Ultraje a Rigor - Acustico MTV/Scenes/title_t02.mkv
./Ultraje a Rigor - Acustico MTV/Scenes/title_t05.mkv
./Ultraje a Rigor - Acustico MTV/Scenes/title_t04.mkv
./Ultraje a Rigor - Acustico MTV/Scenes/title_t03.mkv
./Ultraje a Rigor - Acustico MTV/title_t00.mkv
Could someone help me to understand what is happening and how to fix it?
RG