I would recommend a bash script for this sort of thing. The advanced bash scripting guide should have all you need: http://www.tldp.org/LDP/abs/html/
Bash is good because it allows you to use normal console commands in a script.
I cannot recall how to use smbclient to move file so you will have to figure that part out yourself but the man page for the smbclient command will certainly be helpful, just open a terminal and use:
#infinite loop so that we do this forever
while [ 1 ]; do
ping -c 1 -W 5 192.168.0.1
if [ $? == 0 ]
echo 'the return code of ping indicates desktop is available'
#this is where you would do what you need to to move the files
echo 'the return code of ping indicates the desktop is not available'
This same documentation is generally available on the web just google man smbclient, it is also available in System>Help.