Created
April 9, 2011 19:51
-
-
Save koma5/911714 to your computer and use it in GitHub Desktop.
copy all films in a given directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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