Skip to content

Instantly share code, notes, and snippets.

@DavidLazic
Created April 15, 2021 23:08
Show Gist options
  • Save DavidLazic/81820e6d95ef46394b9f4cccd7ee2f5b to your computer and use it in GitHub Desktop.
Save DavidLazic/81820e6d95ef46394b9f4cccd7ee2f5b to your computer and use it in GitHub Desktop.
NVIDIA_cleanup
#!/bin/bash
declare -A EXCLUDED_FILES=(
[config]=1
[status.json]=1
[latest]=1
[PostProcessing]=1
)
declare -a CLEANUP_LOCATIONS=(
C:/NVIDIA
C:/ProgramData/'NVIDIA Corporation'/Downloader
C:/'Program Files'/'NVIDIA Corporation'/Installer2
)
for i in "${CLEANUP_LOCATIONS[@]}"
do
echo "
--------------------------------------
# Scanning '${i}'
--------------------------------------"
if [[ ! -d ${i} ]]
then
echo "- ${i} non existent, skipping..."
continue
fi
cd "${i}"
for file in *
do
if [[ ! -v EXCLUDED_FILES[$file] ]]
then
size=$(du -sh ${file} | cut -f1)
echo "- Removing | ${size} | ${file}"
rm -rf ${file}
fi
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment