Linux - Copy only attributes of files into a folder

Asked

Viewed 213 times

1

At first... I had a problem with my partitioning and needed to reset my hard drive. I am running Linux Mint 19 on Live-CD (USB) to be able to copy the contents of my /home folder (which was on another partition - /dev/sda6 - and I mounted in /mnt) to an external hard drive. For that, I used the command:

cp -r /mnt/user /media/mint/Samsung\ M3/BKP/Linux/home/user -v.

Result: all files were copied successfully. However, they did not come with the proper permissions, attributes, Owners and etc.

Has how I recover this information (copy only the attributes of the original files to those of the existing backup)?

1 answer

1


When it is necessary to copy the information of owners and groups of the file you must use the parameter -p , in your case the command to copy the files and keep the permissions would be:

cp -rp /mnt/user /media/mint/Samsung\ M3/BKP/Linux/home/user -v

More details of the cp command can be seen on the terminal itself with the command man cp

Browser other questions tagged

You are not signed in. Login or sign up in order to post.