Created
February 12, 2013 19:02
-
-
Save ielcoro/4772366 to your computer and use it in GitHub Desktop.
Renombrar Ficheros Paquetes en GestorAcciones.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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