Linux find command

Hi! I used this command for finding and copying files:

find /var/www/html/official -name ‘*.js’ -exec cp --parents {} /official ;

My task was failed, and when I was going to research problem and show it to you, I got error, you can see it on the screen

@raiveton

This is where the issue is, you copied whole stuff directly after running fine command:

copy

I can explain it. I didn’t get the task clearly - how to prevent parent dirs? From absolute path (/var/www/…) or relative path? So I saved it in two ways. If it possible, can you reassign task for me?

Yeah, there is a question, relative parent structure or absolute ?

In my case there is an error with connectivity still

I made this task maybe a four times and still got error
“Note: This quiz portal has lost connectivity with the terminal session. Either your session has expired. Or there is an issue with your internet connectivity. Check to see if the terminal is responding. If not please refresh the terminal window to load a new session. Apologies for the inconvenience caused.”

This time I checked on chrome console, and in this scenario there are some errors:

Error: Container Stopped↵ at Object.track (https://cdn.trackjs.com/releases/current/tracker.js:54:36)↵
at Socket. (https://katacoda.com/javascripts/terminal-application.js:1:8870)↵
at Socket.Emitter.emit (https://katacoda.com/socket.io/socket.io.js:35:259)↵
at Socket.onevent (https://katacoda.com/socket.io/socket.io.js:16:25)↵
at Socket.onpacket (https://katacoda.com/socket.io/socket.io.js:15:553)↵
at Manager. (https://katacoda.com/socket.io/socket.io.js:29:519)↵
at Manager.Emitter.emit (https://katacoda.com/socket.io/socket.io.js:35:259)↵
at Manager.ondecoded (https://katacoda.com/socket.io/socket.io.js:8:542)↵
at Decoder. (https://katacoda.com/socket.io/socket.io.js:29:519)↵
at Decoder.Emitter.emit (https://katacoda.com/socket.io/socket.io.js:35:259)"
timestamp: “2020-04-03T21:17:03.944Z”
visitor: [{timestamp: “2020-04-03T21:13:34.646Z”, action: “input”, element: {tag: “textarea”,…}},…]
version: “2.13.0”
throttled: 0

Guys,

Connectivity issue should be resolved now, sorry for the inconvenience caused.

Ok! Can you answer please?

I can explain it. I didn’t get the task clearly - how to prevent parent dirs? From absolute path (/var/www/…) or relative path? So I saved it in two ways. If it possible, can you reassign task for me?

@raiveton

Failed/expired tasks will be reassigned to you sometime in near future so you can give it an another try.

You copy and keep the parent structure by adding backslash
-exec cp --parents \ { \ }

Hi i am done this task but it showing me failed please check and response

@drflex007 You had to copy all files by keeping parent directories structure as asked in the question.

Thanks Inderpreet
I think I did this question answer same as question was asked. Did this question again appear me on the task list .

@drflex007 yes, you will get these failed/expired tasks again in near future.

Solution: Linux Find Command Kodekloud

guys follow this

find /var/www/html/ecommerce -type f -name '*.css' -exec cp --parents {} /ecommerce \;

Guys: Please review this post and provide input.

In short, command used is as follows:

follow this:

find /var/www/html/ecommerce -type f -name '*.css' -exec cp --parents {} /ecommerce \;
1 Like