Skip to content

Instantly share code, notes, and snippets.

@Dimon70007
Created January 31, 2023 11:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dimon70007/e19a47aea1efc7c31747b0d3c2643c6c to your computer and use it in GitHub Desktop.
Save Dimon70007/e19a47aea1efc7c31747b0d3c2643c6c to your computer and use it in GitHub Desktop.
Remove temporary files script recursivelly
#!/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