This is linux 6 day question , data transfer

HI kodekloud team

this is day 6 of linux user data transfer.
i have to copy all the files owned by javed user from /home/usersdata to /media directory.
i used file.sh script file to copy files .
this is my script that i used for this question
#!/bin/bash
cd /home/usersdata
list=$(find . -type f -user javed)
for i in $list
do
cp $i /media
done
after that i verified all the files were present in /media directory
but when i check , it threw error "no files are copied and some are missing on app server "
what to do ?

That’s the question that looks like this?

Due to an accidental data mix-up, user data was unintentionally mingled on Nautilus App Server 2 at the /home/usersdata location by the Nautilus production support team in Stratos DC. To rectify this, specific user data needs to be filtered and relocated. Here are the details:
Locate all files (excluding directories) owned by user yousuf within the /home/usersdata directory on App Server 2. Copy these files while preserving the directory structure to the /ecommerce directory.

Note that the user name, directories and server may change each time you do the question.

  1. Make sure you are doing it on the correct app server. This time it is App Server 2
    thor@jump-host ~$ ssh steve@stapp02
    steve@stapp02's password: 
    [steve@stapp02 ~]$ 
    
  2. Become root. You can’t copy Yousuf’s files while you are logged in as Steve.
    sudo -i
    
  3. Find and copy files
    find /home/usersdata -type f -user yousuf -exec cp --parents {} /ecommerce \;
    

image

Hi you can refer to my solution for help and if its help make sure to star my repo.

basically i wanted to do this using bash script file that contained scripts
#!/bin/bash
cd /home/usersdata
list=$(find . -type f -user javed)
for i in $list
do
cp $i /media
done

That would probably work if you do

cp --parents %i /media

because the question states to preserve the directory structure.