There is a remote system where i have read/write permissions only in one directoty. I use it to store the results of the nightly builds.
For uploading the results for a specific day, i do an rsync
of <date_dir>
on the remote directory using following command:
rsync -zavR <date_dir> <server_name>:/path/of/the/directory/where/i/have/permission/
Now, sometimes i need to delete the <date_dir>
directory at destination. For this, I tried following command:
rsync -avh <date_dir> <server_name>:/path/of/the/directory/where/i/have/permission/ --delete
This command deletes the contents of <date_dir>
at destination but the directory <date_dir>
itself is not deleted.
I also tried to give --force-delete
in rsync command, but it gives following error on my system:
rsync: --force-delete: unknown option
What can be the command to delete the <date_dir>
directory on the remote server using rsync
.
PS: I tried setting up password-less authentication using SSH
but i don't have permissions to do that.
Since this is the very directory you are going to copy, rsync
won't delete it. --delete
means to remove a directory or file which does not exist on the senders side. Obviously, date_dir
exists on your local machine (otherwise rsync would complain about copying a non-existent directory). If you want to keep your local directory and only delete the remove copy, rsync
is not the right tool, but you could use rsh ..... rm -r
to remove the directory on the remote side.