I need to use the find command to get files that are not declared in an array.
# ALLOWED extensions
ext_allowed=("*.cs" "*.csproj" "*.sln" "*.json")
combined=""
for ext in "${ext_allowed[@]}"; do
combined="$combined -not -name \"$ext\""
done
# This doesn't work :(
find $location $combined -not -type d
# This does work, but it looks the same??
find $location -not -name "*.cs" -not -name "*.csproj" -not -name "*.json" -not -name "*.sln" -not -type d
The variable location, just holds the location of the files. I also tried it already with the -o option in between, but this also does not work.
Can anyone help me out please? Thanks