How to change the ownership of a file during copy itself. I mean in cp
command how to add ownership
I cant rely on --preserve
and copying the file and then changing the ownership of file due to some constraints.
Thanks
As stated here: https://unix.stackexchange.com/questions/124855/move-files-and-change-ownership-at-the-sametime
Use rsync(1):
rsync \
--remove-source-files \
--chown=wanteduser:wantedgroup \
/home/oldfolder /home/newfolder
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With