Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

147
Visualizações
Why is find -delete faster than rm -rf?

Why is find ... -delete so much faster than rm -rf ? Specifically,

To clarify: I'm specifically asking: Why is find ./x -type d -delete && rm -rf x so much faster than rm -rf x/?

Background

There have been a few people who use similar mechanisms, like rsync.

  • There are several posts on why rm -rf is slow. For example, https://unix.stackexchange.com/questions/106133/why-is-rm-slow is probably one of the most focused ones.

  • Specifically, I've found cd dir-to-delete && find . -type d -delete followed by rm -rf dir-to-delete is extremely fast, even on large directories.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

rm -f isn't slow, but if you run it many files and you fire up a separate process per each rm, then it will be slow, because starting a process will cost you about 2ms on modern processor, and many files can be deleted in that time if you instead delete in batches, which is what find's -delete does. Alternatively, you can use xargs to run rm with a batch to pretty much the same effect.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda