I have to cleanup an archive directory on a remote host only if there are files to be archived; the source files are on the same host. I should run something similar to:
cd $source_dir if [ -f *.tar.gz ] then rm -fr $arch_dir/* mv *.tar.gz $arch_dir fi
The problem is that I can use only scp, rsync or sftp. How to achieve this?