Rsync – MOVE files from remote source to local destination

rsync

I'm trying to MOVE files from remote server to local folder. Files need to be REMOVED from remote source.
I tried:

rsync -avz –remove-source-files ssh remote_user@remote_machine:/home/remote_user/a_folder/ ~/a_folder/

which copies but does not remove the files from the remote source

Thanks

Best Answer

Does it have to happen in one command, you could just copy, then delete?

Another option would be to mount via SSHFS and use mv to move the files.

UPDATE

Two commands isn't really much more difficult or complex than one;

rsync -avz ssh remote_user@remote_machine:/home/remote_user/a_folder/ ~/a_folder/
ssh remote_user@remote_machin rm -rf /home/remote_user/a_folder/*