Skip to content

Instantly share code, notes, and snippets.

@Osse
Created October 9, 2012 16:20
Show Gist options
  • Save Osse/3859834 to your computer and use it in GitHub Desktop.
Save Osse/3859834 to your computer and use it in GitHub Desktop.
Remove oldies
unset -v latestpdf latestcsv
set extglob
for file in *.pdf; do
[[ "$file" -nt "$latestpdf" ]] && latestpdf="$file"
done
for file in *.csv; do
[[ "$file" -nt "$latestcsv" ]] && latestcsv="$file"
done
rm !("$latestpdf"|"$latestcsv"|!(*pdf|*csv))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment