#!/bin/bash

echo "Enable extglob bash feature"
shopt -s extglob
shopt extglob

# Prepare test-case
cd /tmp/
mkdir -p subtest/client/cpp && cd subtest/client/cpp
touch CMakeLists.txt && mkdir src && touch blubb.readme
cd /tmp/subtest

# Remove all but client
rm -rf ./!(client)

# Make temp dir
temp=$(mktemp -d ./XXXXXXXX)

# Copy contents of desired sub-folder to sub folder
cp -R client/cpp/* ${temp}/
# Cleanup
rm -rf client

# Move desired content to top-level
mv ${temp}/* .
# Cleanup
rm -rf ${temp}

ls /tmp/subtest

echo "Done."
