Renaming In .net With C#

Renaming Your files using c# just copy and paste your code.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace rhozetApplication3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private int File_Delete(string Filepath)
{
FileInfo fi = new FileInfo(Filepath);

if (fi.Exists)
{
fi.Delete();
}
return 1;
}

private int File_rename(string FilepathOld, string FilepathNew)
{
FileInfo fi = new FileInfo(FilepathOld);

if (fi.Exists)
{
fi.MoveTo(FilepathNew);

}
return 1;
}

private void button1_Click(object sender, EventArgs e)

{

FileInfo fi = new FileInfo(“C:\\dateiname.txt”);

if (fi.Exists)
{
fi.MoveTo(“C:\\dateiname.mpg”);
textBox1.Text = ” Succesfull! “;
}
else
{
textBox1.Text = ” Failed! “;
}
}
}}

in c# rename your files by coding just use this code

You can leave a response, or trackback from your own site.

Leave a Reply