Task find files

Hi guys,

I got a task to copy files .js extensions I copied the file as you can see in the image, but the task was marked as failed.

Thank you for your help!

The error showed in the task is :

hey there!

I’d do this to make sure the task would be done correctly :

  1. count all files with .js extension
  2. make sure to list only files - not folders
  3. copy them with their parent directory structure

this would do the job :
find . -name ‘*.js’ -print0 | egrep -v ‘^d’ | cpio -pdm /destDir

Thank you @siraj_krm but the problem is that I dont remember that the question ask to copy the parent directory.

you missed the parent directory in your cp command. you should try cp --parents.

1 Like

Thank you for the feedback @wfranca