Linux User Files task

hey guys, follow the below cmd,

find . -user mariyam | cpio -pdm /blog
(user) (directory)

1 Like

Hello Uppalapati,
can you please clarify your question please what is the issue and what is the errors you get and where did this issue happened ?

thanks,
KodeKloud

All good, it executed, thanks

Hello Uppalapati,
can you explain the cpio in your command and what does the option -m do ,

Hi @belal_88 ,

-m, --preserve-modification-time
Retain previous file modification times when creating files.

Reference: - man cpio page

Regards,

I am getting permission denied when i execute above command. Any idea, i also tried to change the permissions to destination directory but still getting same error. please suggest.

Hello Ayman,
I failed this task many times. Please Help me to solve this… I follow the question and search how to preserved the file directory path.

Try sudo su command. Switch to root user.


so the solution would be
sudo find /home/usersdata -user rose -type f | cpio -pdm /official

I’ve solved the task with this command.

cd /home/usersdata
sudo find . -user kirsty -type f -exec cp --parents {} /media ;