Skip to content

Instantly share code, notes, and snippets.

@koma5
Created April 9, 2011 19:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koma5/911714 to your computer and use it in GitHub Desktop.
Save koma5/911714 to your computer and use it in GitHub Desktop.
copy all films in a given directory
#! /bin/sh
torrent=$1
#destination=$2
destination="root@172.16.52:/streamer/movie/"
extension="\
.avi \
.mp4 \
.mkv \
.mov \
.srt \
"
stamp=`date +%s.%N`
mkdir /tmp/$stamp
cp --force -R "$torrent" /tmp/$stamp
/dow/scripts/log.sh "copied $torrent -> /tmp/$stamp"
for i in $extension
do
echo extension: $i
find /tmp/$stamp -type f -print | grep $i |
while read j; do
scp -r "${j}" $destination
/dow/scripts/log.sh "scp file $j -> $destination"
done
done
rm -rf /tmp/$stamp
/dow/scripts/log.sh "/tmp/$stamp removed"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment