Skip to content

Instantly share code, notes, and snippets.

@jgrar
Created January 29, 2014 02:24
Show Gist options
  • Save jgrar/8680697 to your computer and use it in GitHub Desktop.
Save jgrar/8680697 to your computer and use it in GitHub Desktop.
#/bin/sh
ssh jgr@mindlock.us 'find ~/irclogs/ -type f ! -empty | grep -v ".*/$(date "+%Y")/[^/]*/.*\.$(date "+%m")-$(date "+%d")\.log" | sed "s|$HOME/irclogs/||"' > targets
cat targets | while read line
do
mkdir -p ~/irclogs/$(echo $line | sed -e 's|/[^/]*$||')
scp -B -C -p jgr@mindlock.us:'~/irclogs/'$line ~/irclogs/$line
done
ssh jgr@mindlock.us "sed 's|.*|$HOME/irclogs/&|' | xargs rm -f" < targets
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment