Created
January 31, 2023 11:59
-
-
Save Dimon70007/e19a47aea1efc7c31747b0d3c2643c6c to your computer and use it in GitHub Desktop.
Remove temporary files script recursivelly
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
dirs_to_remove='Pods build builds node_modules*' | |
if [ -z "$target_dir" ]; then | |
target_dir='./' | |
fi | |
echo ">>> Will be removed dirs <<<" | |
del_dir () { | |
echo "$1" | |
rm -rf $1 | |
} | |
export -f del_dir | |
for rmvdir in ${dirs_to_remove}; do | |
find $target_dir -name $rmvdir -maxdepth 6 -type d -exec bash -c 'del_dir "$0"' {} \; | |
done | |
# rm -rf ${dir_paths_rm} | |
echo ">>> Removing succeed <<<" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment