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.
@Tej-Singh-Rana@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
thor@jump_host /$ ssh steve@stapp02
The authenticity of host ‘stapp02 (172.16.238.11)’ 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,172.16.238.11’ (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
903
[root@stapp02 steve]# find /beta -type f -name '.php’ | wc -l
903
[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 . @Tej-Singh-Rana@Inderpreet may confirm if my understanding is correct