Skip to content

Instantly share code, notes, and snippets.

@kaorun55
Created April 23, 2015 06:43
Show Gist options
  • Select an option

  • Save kaorun55/e7a9606444006085bdfa to your computer and use it in GitHub Desktop.

Select an option

Save kaorun55/e7a9606444006085bdfa to your computer and use it in GitHub Desktop.
using System;
using System.IO;
using System.Reflection;
namespace Rename
{
class Program
{
static void Main( string[] args )
{
int begin = 46;
int end = 145;
var path = Path.GetDirectoryName( Assembly.GetEntryAssembly().Location );
Console.WriteLine( path );
var sourcePath = Path.Combine( path, "original" );
var targetDir = "renamed";
var targetPath = Path.Combine( path, targetDir );
Directory.CreateDirectory( targetDir );
for ( int i = begin; i <= end; i++ ) {
var sourceFileName = Path.Combine( sourcePath, string.Format( "R0010{0:000}.JPG", i ) );
var targetFileName = Path.Combine( targetPath, string.Format( "R{0:0000}.JPG", i - begin ) );
File.Copy( sourceFileName, targetFileName );
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment