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 [email protected] '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 [email protected]:'~/irclogs/'$line ~/irclogs/$line
done
ssh [email protected] "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