busybox version 1.33.0
I'm trying to copy the entire home
folder.
Inside of home
, /dev/sda2/
is mounted, like so:
/home/user/sda2
/home/user/sda2/root
/home/user/sda2/home_backup
Above you can see the root/
directory within sda2/
, owned by actual root
. Also, there is home_backup/
which will store files from /home
.
My issue is:
After executing the following line I get a nice list of files, and /home/user/sda2
and its contents are nowhere to be found, which is what I wanted:
LC_ALL=C find /home -path /home/user/sda2 -prune -o -iname '*' -print \;
But with the following, I always get the operation not permitted
error for directory root/
(is accurate, I'm not the owner, a regular user), meaning that it doesn't prune sda2
as I expected:
LC_ALL=C find /home -path /home/user/sda2 -prune -o -iname '*' -exec cp -r '{}' /home/user/sda2/home_backup/ ;/
For obvious reasons /home/user/sda2
must be excluded, to not copy the same data over and over.
Checking this doesn't really answer my question but it gave me a notion on how prune
works.
https://stackoverflow.com/questions/1489277/how-to-use-prune-option-of-find-in-sh/1489405#1489405
EDIT
I just realized that with the previous line all files will be all mixed up under home_backup
but that's not an issue, I still want to know why I can't "prune" properly.