Skip to content

Instantly share code, notes, and snippets.

@liangzan
Last active December 27, 2015 08:36
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 liangzan/41e96a106aa108c94bd0 to your computer and use it in GitHub Desktop.
Save liangzan/41e96a106aa108c94bd0 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# leaves 5 copies of the standalone app
total_files=$(find -name '*.jar' -type f -print0 | xargs -0 ls -t | wc -l)
file_num_to_remove=`expr $total_files - 5`
find -name '*.jar' -type f -print0 | xargs -0 ls -t | tail -n $file_num_to_remove | xargs rm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment