Skip to content

Instantly share code, notes, and snippets.

@9to6
Created October 10, 2019 04:46
Show Gist options
  • Save 9to6/dae2bf86be63f2873b98a58e0a7ca3c3 to your computer and use it in GitHub Desktop.
Save 9to6/dae2bf86be63f2873b98a58e0a7ca3c3 to your computer and use it in GitHub Desktop.
The command to remove old directories exclude last two
ls -ld */ | grep "$DIRECTORY_NAME" |head -n -2 | awk '{print $9}' |xargs rm -rf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment