# Create test directory with following tree structure
# directory
# |-- 1
# |-- 10
# |-- 2
# |-- 3
# |-- 4
# |-- 5
# |-- 6
# |-- 7
# |-- 8
# `-- 9
# 
# 10 directories, 0 files

cd /tmp
mkdir -p directory
cd directory
mkdir -p `seq 1 10`
cd ..

# Set an exclude list with no relative neither absolute path
rm -f exclude.list
touch exclude.list
echo "Exclude list with no apparent logical path"
echo "------------------------------------------"
echo 1 >> exclude.list
echo 10 >> exclude.list

echo "exclude.list contains:"
echo "----------------------"
cat exclude.list
echo "----------------------"

7z a /tmp/directory.7z /tmp/directory -x@exclude.list
7z l /tmp/directory.7z
rm -f /tmp/directory.7z

# Set an exclude list with relative path
rm -f exclude.list
touch exclude.list
echo "Exclude list with relative path"
echo "-------------------------------"
echo directory/1 >> exclude.list
echo directory/10 >> exclude.list

echo "exclude.list contains:"
echo "----------------------"
cat exclude.list
echo "----------------------"

7z a /tmp/directory.7z /tmp/directory -x@exclude.list
7z l /tmp/directory.7z
rm -f /tmp/directory.7z

# Set an exclude list with absolute path

rm -f exclude.list
touch exclude.list
echo "Exclude list with absolute path"
echo "-------------------------------"
echo /tmp/directory/1 >> exclude.list
echo /tmp/directory/10 >> exclude.list

echo "exclude.list contains:"
echo "----------------------"
cat exclude.list
echo "----------------------"

7z a /tmp/directory.7z /tmp/directory -x@exclude.list
7z l /tmp/directory.7z
rm -f /tmp/directory.7z

rm -fr exclude.list directory
