Skip to content

Instantly share code, notes, and snippets.

@joelataylor
Created September 18, 2012 22:16
Show Gist options
  • Save joelataylor/3746288 to your computer and use it in GitHub Desktop.
Save joelataylor/3746288 to your computer and use it in GitHub Desktop.
Remove small files
#!/bin/bash
# The goal of this script is to delete any files under 1mb (1048576 bytes)
while read -r file; do
length=$(swift stat audio-in "$file" | grep 'Content Length' | sed 's/Content Length: //')
#echo "Length is: $length"
if (( length < 1048576 )) ; then
swift delete audio-in "$file"
#echo "deleting $file"
fi
done < <(swift list audio-in)
@cigoe
Copy link

cigoe commented Sep 18, 2012

  find . -size -1M -exec rm {} \;

::muscle::

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