Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

510
Vistas
How to search (using find command) for directories and copy all the files and directory itself to another directory in linux?

How to search (using find command) for directories and copy all the files and directory itself to another directory in linux? Here is what I have so far:

find -type d -name "*.ABC" -exec {} /Desktop/NewFile \;

I get this as output:

find: './GAE/.ABC: PERMISSION DENIED

Please Help, Thanks!

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

Your error here above has nothing to do with file read permission. You're trying to execute the directories you find! Avoid running commands as root or sudo unless: (1) you really need it and (2) you really know what you're doing. Quite often people asking for root or sudo privileges are exactly the ones should not have it.

That said... there are several ways to copy a directory tree under *nix. This is just one possible approach:

$ find <start> -type d -name \*.ABC -exec cp -av {} <target> \;

Where:

  • <start> is a directory name. It's used to tell find where to start its search (for example /usr/local or $HOME)
  • <target> is another directory name to define the final destination of your copied directories

UPDATE

In case you want to search for multiple paths...

$ find <start> -type d \( -name \*.ABC -o -name \*.DEF \) -exec cp -av {} <target> \;
over 4 years ago · Santiago Trujillo Denunciar

0

This should work:

find ./source_dir -name \*.png -print0 | xargs -0 cp -t path/to/destination

For more info, you can look up here.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda