Skip to content

Instantly share code, notes, and snippets.

@deltamualpha
Forked from fernandoaleman/gist:4551494
Last active August 29, 2015 13:57
Show Gist options
  • Save deltamualpha/9918757 to your computer and use it in GitHub Desktop.
Save deltamualpha/9918757 to your computer and use it in GitHub Desktop.
A one-liner to delete the crud files that s3fs leaves in your mounted s3 directories after you've quit using s3fs
s3cmd ls --recursive s3://BUCKET_NAME |\
ruby -rdate -ne 'date, time, size, uri = $_.split; puts uri if size == "0" && uri[-1,1] != "/" && !uri.include?(".")' |\
xargs s3cmd del
@deltamualpha
Copy link
Author

Updates to exclude files with a dot in them -- mostly site-specific, but we have a few 0-byte files that are not s3fs-related that this catches and ignores.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment