Skip to content

Instantly share code, notes, and snippets.

@ielcoro
Created February 12, 2013 19:02
Show Gist options
  • Save ielcoro/4772366 to your computer and use it in GitHub Desktop.
Save ielcoro/4772366 to your computer and use it in GitHub Desktop.
Renombrar Ficheros Paquetes en GestorAcciones.cs
private void RenombrarFicherosPaquete(TAccion accionEnvio, string rutaPaquete, int numeroVersionPaquete)
{
var sufijoNumeroVersionPaquete = String.Format(FORMATO_NUMERO_VERSION_PAQUETE, numeroVersionPaquete);
var directorioPaquete = new DirectoryInfo(rutaPaquete);
var ficherosPaquete = directorioPaquete.GetFiles(accionEnvio.NombreFichero + "*");
foreach (var ficheroPaquete in ficherosPaquete)
{
if (ficheroPaquete.DirectoryName == null)
continue;
var nombreFicheroSinExtension = Path.GetFileNameWithoutExtension(ficheroPaquete.FullName);
if (nombreFicheroSinExtension != null)
{
File.Move(ficheroPaquete.FullName,
Path.Combine(ficheroPaquete.DirectoryName,
String.Format("{0}{1}{2}",
Regex.Replace(
nombreFicheroSinExtension,
EXPRESION_REGULAR_NUMERO_VERSION_PAQUETE, string.Empty),
sufijoNumeroVersionPaquete,
ficheroPaquete.Extension)));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment