Score:0

unable to copy folders with same permission

bw flag

I want to copy /var/lib with same permissions of all files and folders.

some articles says cp -rp /var/lib/ /var/libnew/

and some says use rsync -aX /var/lib /var/libnew/

explain please which one is better as most important thing in which All permissions should be same 100 percent.

Score:1
es flag

Both articles are correct and does what you want.

I prefer using rsync -avh --progress <source>/ <destination> (in your case: rsync -avh --progress /var/lib/ /varlibnew) for the progress bar of the copying, you can also add -u if you want to update files in destination, if they are newer.

With rsync, mind that trailing / are of importance, if both source and destination have trailing /:s, then the destination goes one level deeper.

bw flag
ok thanks this is working fine for me with progress status.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.