Here's the short script:
Code: Select all
#!/bin/sh
#
# SABnzbd Post Processing for TV downloads
#
# Copy downloaded TV to ViewingSys:/Videos/TV
scp -Bqr /Downloads/Complete/TV/* ViewingSys:/Videos/TV
# Move downloaded TV to local TV backup dir
mv -f /Downloads/Complete/TV/* /Backup/TV
Code: Select all
scp -Bqr $1 ViewingSys:/Videos/TV
Now, the portion I'm having issues with. The mv portion works perfect, unless there is already a directory with the same name in the backup dir. I thought about using "cp -r" and then "rm -r" on the directory, but of course I want to be completely sure of what I'm doing my "rm -r" on. ;-)
If I understand correctly (and the $1 works as I mention about changing in my above "copy" portion of the script), I should be able to just change the "mv" command to something like:
Code: Select all
cp -r $1 /Backup/TV
rm -r $1
Code: Select all
rsync -a --remove-source-files --whole-file $1 /Backup/TV
rmdir $1
--edit--
Well, I tried the option of changing my hard coded directory to $1 and it didn't work.. I've changed my script back to the directory and it's working great now. I decided to go the route of rsync and rm -r /directory/* - and it 'seems' to be working fine now. :-) Though...if anyone has any suggestions as to a better way of doing it, it would definitely be appreciated!
Thanks!!