Skip to content

Instantly share code, notes, and snippets.

@nowthatsamatt
Created December 18, 2014 18:19
Show Gist options
  • Save nowthatsamatt/3a297dd91262cd5d9e72 to your computer and use it in GitHub Desktop.
Save nowthatsamatt/3a297dd91262cd5d9e72 to your computer and use it in GitHub Desktop.
hooraytime
#!/bin/bash
sandbox_path='/home/SANDBOX/www/yaytime/website/sandbox'
userdir_array=($(ls -l /home/SANDBOX/www/yaytime/website/sandbox|awk '{print $9}'))
for i in "${userdir_array[@]}"; do
ls -tlh $sandbox_path/$i|tail -n$(expr $(ls -tlh|wc -l) - 11)|awk '{print $9}'|xargs -t -L 1 rm $sandbox_path/$i/
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment