Linux – Move files and change ownership at the sametime

chownfileslinuxrename

On Linux (Debian, Ubuntu Mint…),
Is there any option command or something that I can use to transfer files to another user without having to do :

sudo mv /home/poney/folderfulloffiles /home/unicorn/
sudo chown -R unicorn:unicorn /home/unicorn/folderfulloffiles

Best Answer

Use rsync(1):

rsync \
  --remove-source-files \
  --chown=unicorn:unicorn \
    /home/poney/folderfulloffiles /home/unicorn/
Related Question