46 lines
1.1 KiB
Bash
Executable File
46 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Get list of config folders
|
|
CONFIG_DIR="$HOME/.config"
|
|
CONFIG_FOLDERS=($(find "$CONFIG_DIR" -mindepth 1 -maxdepth 1 -type d -printf "%f\n"))
|
|
|
|
# Get list of installed APT packages
|
|
APT_PACKAGES=($(dpkg -l | awk '{print $2}' | tail -n +6))
|
|
|
|
# Get list of installed Flatpak apps (application IDs only)
|
|
FLATPAK_APPS=($(flatpak list --app --columns=application))
|
|
|
|
# Combine all installed package names
|
|
INSTALLED_APPS=("${APT_PACKAGES[@]}" "${FLATPAK_APPS[@]}")
|
|
|
|
# Initialize list of redundant config folders
|
|
REDUNDANT=()
|
|
|
|
for folder in "${CONFIG_FOLDERS[@]}"; do
|
|
FOUND=0
|
|
for app in "${INSTALLED_APPS[@]}"; do
|
|
if [[ "$folder" == "$app" ]]; then
|
|
FOUND=1
|
|
break
|
|
fi
|
|
done
|
|
if [[ $FOUND -eq 0 ]]; then
|
|
REDUNDANT+=("$CONFIG_DIR/$folder")
|
|
fi
|
|
done
|
|
|
|
# Output results
|
|
COUNT=${#REDUNDANT[@]}
|
|
|
|
if [[ $COUNT -eq 0 ]]; then
|
|
echo "No redundant config folders found."
|
|
else
|
|
echo "$COUNT redundant config folders found:"
|
|
for path in "${REDUNDANT[@]}"; do
|
|
echo "- $path"
|
|
done
|
|
echo
|
|
echo "To remove them, run:"
|
|
echo "rm -r ${REDUNDANT[*]}"
|
|
fi
|