Linux find command task has failed

Hi @Inderpreet @player001 @KodeKloud

I have used below command to copy full directory structure as mentioned by @Inderpreet in

cp --parents /var/www/html/blog/*.php /var/www/html/blog
i have copied 917 .php files to target and verified same in target using below command

then used below command to verify the .php files in target location

find /var/www/html/blog -type f -name ‘*.php’ | wc -l

but my task has failed. I noticed lot of connectivity issues
KKE: Sasi

pls check and let me know.

Hello, Sasi
That’s not a suitable steps. It will copy only *.php files but as per task we need their parent directory also.

Hello @Inderpreet @player001
in thread Why "Linux Find Command Failed"?
inderpreet mentioned to refer the article to copy the files with the parent directory structure. to complete this task.

this command copies the .php files along with its parent directory structure.

cp --parents /var/www/html/blog/*.php /var/www/html/blog

i have a folder structure with a bunch of *.csv files scattered across the folders. Now I want to copy all *.csv files to another destination keeping the folder structure.

It works by doing:

cp --parents *.csv /target
cp --parents */*.csv" /target
cp --parents */*/*.csv /target
cp --parents */*/*/*.csv /target

i have exactly used the same command
cp --parents /var/www/html/blog/*.php /var/www/html/blog

and verified the .php files in target location

find /var/www/html/blog -type f -name ‘*.php’ | wc -l

can you check why it is marked as failed.

@player001 @Inderpreet in the task it is mentioned not to copy other files from source except the .php but the folder path should include parent directory structure which the below task accomplishes

cp --parents /var/www/html/blog/*.php /var/www/html/blog

can you pls check why this is marked as failed? i did exactly what the task needed.

Hi the below task is working and successful.

thor@jump_host / ssh steve@stapp02 The authenticity of host 'stapp02 (' can't be established. ECDSA key fingerprint is SHA256:cwxNDKAxQecZYp4eRl7WDYB6Yi/9JhodFI27iVuaqGQ. ECDSA key fingerprint is MD5:f8:54:95:38:41:cc:af:41:0e:83:ec:b9:55:aa:cf:13. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'stapp02,' (ECDSA) to the list of known hosts. steve@stapp02's password: Permission denied, please try again. steve@stapp02's password: [steve@stapp02 ~] sudo su

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

#1) Respect the privacy of others.    #2) Think before you type.
#3) With great power comes great responsibility.

[sudo] password for steve:
[root@stapp02 steve]# find /var/www/html/beta -name ‘.php’ -exec cp --parents {} /beta
find: missing argument to `-exec’
[root@stapp02 steve]# find /var/www/html/beta -name '
.php’ -exec cp --parents {} /beta ;
[root@stapp02 steve]# find /var/www/html/beta -type f -name ‘.php’ | wc -l
[root@stapp02 steve]# find /beta -type f -name '
.php’ | wc -l
[root@stapp02 steve]# Connection to host01 closed by remote host.
Connection to host01 closed.

hi @Sasi may be you have already figured out by now. I think using command cp --parents /var/www/html/blog/*.php /var/www/html/blog will only copy any .php file only located in /var/www/html/blog/ and not from any other directories which is present inside /blog . @player001 @Inderpreet may confirm if my understanding is correct