0

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?

1 Answer 1

1

given those requirements, why not use something like python/perl on the client side for an interactive sftp session, then you can easily check for the file existence in the archive directory and move the files, etc.

http://www.pythonforbeginners.com/modules-in-python/python-secure-ftp-module

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .