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

303
Vistas
rename files containing _2_ to -2- returns invalid option -- '2'

I am trying to rename all files containing _2_ to -2-

find ./ -depth -name "*_2_*" -exec /usr/bin/rename  _2_ '-2-' {} \+

but I get the following error:

/usr/bin/rename: invalid option -- '2'
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

This is a common problem when dealing with filenames that have a leading -, because this is the same character used to indicate command line options.

A fairly common behavior is to interpret the argument -- to mean "end of options", so you can do something like:

find ./ -depth -name "*_2_*" -exec /usr/bin/rename -- _2_ '-2-' {} \+

I've tested this locally and that seems to Do The Right Thing on my system.

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