Takes 2 arguments , source & destination and removes all files except txt. .Im just learning bash so not used/aware of the different functions etc...
mkdir $2
cp -R $1/* $2
for file in $1/*;do #all files in testInput
if [ -d "$file" ] #if its a file then look at the contents of it
then
for inDir in $file/*; do
if [ -d "$inDir" ]
then
for line in $inDir ; do
if [ line != *.txt ]
then
rm line
fi
done
fi
done
else
for files in file; do
if [ files != *.txt ]
then
rm files
fi
done
fi
done
source is a folder which contains the 3 folders and some of these subfolder contain a subfolder and files