SIMULATION -
Find the files owned by harry, and copy it to catalog: /opt/dir
SIMULATION -
Find the files owned by harry, and copy it to catalog: /opt/dir
To find all files owned by the user 'harry' and copy them to the directory /opt/dir, you can use the following set of commands: 1) Change to the /opt directory using the command cd /opt. 2) Create the directory if it does not already exist using mkdir -p dir. 3) Use the find command to locate all files owned by 'harry' and copy them to /opt/dir using find / -type f -user harry -exec cp -p {} /opt/dir/ \;. The -p option in the cp command preserves the attributes of the files. So, the complete set of commands will be: cd /opt; mkdir -p dir; find / -type f -user harry -exec cp -p {} /opt/dir/ \;.
find / -user Harry -type f -exec cp {} /opt/dir \;
find / -user hayder -type f 2>/dev/null -exec cp '{}' /opt/dir \;
find / -user harry -type f -exec cp -rpvf {} /opt/dir \; 2> /dev/null
# cd /opt/ # mkdir dir # find / -user harry -type f -exec cp -rfp {} /opt/dir/ \;
find / -type f -user harry -exec cp {} /opt/dir \;
mkdir /opt/dir; find / -type f -user harry -exec cp -p '{ }' /opt/dir \;
why does it take time to process the command
add -rf to the exec command
May be its looking the entire '/' partition which might take time.
#mkdir /opt/dir #find / -type f -user Harry -exec cp {} -ar /opt/dir \;
sorry #mkdir /opt/dir #find / -type f -user Harry -exec cp -ar {} /opt/dir/ \;
#mkdir -p /opt/dir #find / -user harry -exec cp -rfp {} /opt/dir/ \; #ls ltr /opt/dir - to verify if files appeared or not
What is the answer please? Syntax in the example is not working. [root@station /]# find / -user tom -exec cp {} /opt/dir/ \; cp: '/opt/dir/.bash_logout' and '/opt/dir/.bash_logout' are the same file cp: '/opt/dir/.bash_profile' and '/opt/dir/.bash_profile' are the same file cp: '/opt/dir/.bashrc' and '/opt/dir/.bashrc' are the same file cp: '/opt/dir/tom' and '/opt/dir/tom' are the same file cp: -r not specified; omitting directory '/home/tom' find: ‘/proc/8531/task/8531/fd/6’: No such file or directory find: ‘/proc/8531/task/8531/fdinfo/6’: No such file or directory find: ‘/proc/8531/fd/5’: No such file or directory find: ‘/proc/8531/fdinfo/5’: No such file or directory
mkdir -p /opt/dir cp -nr --parents $(find / /home -xdev -user harry) /opt/dir
after copy them to /opt/dir , how can I verify that is really copy to that? please. I run #cat /opt/dir but don't really see what make me sure. thanks
plz i need account exam topics plzzz <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="9ff8f7feececfaf1effceffcdff8f2fef6f3b1fcf0f2">[email protected]</a>
it's very easy # find / -user harry -exec cp {} /opt/dir/ \;
for i in $(find / -user harry -type -f);do cp -rpvf $i /opt/dir;done
i cannot edit, but the same as solution is: for i in $(find / -user harry);do cp -rpvf $i /opt/dir;done
find / -user Harry -type f -exec cp -fp {}/opt/dir \; or cp -fp $(find / -user Harry -type f) /opt/dir
find / -user Harry -type f -exec cp -fp /opt/dir \; or cp -fp $(find / -user Harry -type f) /opt/dir