using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Default3 : System.Web.UI.Page
{
SqlConnection CN = new SqlConnection(@"SERVER=172.29.57.158\sql2012;Database=eMAAS;User ID=sa;Password=Mind1234");
protected void Page_Load(object sender, EventArgs e)
{
Label2.Visible = false;
}
protected void Button1_Click(object sender, EventArgs e)
{
string ext;
string[] allfiles = System.IO.Directory.GetFiles(TextBox1.Text, "*.*", System.IO.SearchOption.AllDirectories);
foreach (var file in allfiles)
{
FileInfo info = new FileInfo(file);
string name = info.Name.ToString();
ext =info.Extension.ToString();
if (ext == ".ldb" || ext == ".LDB")
{
ext = "Microsoft Access Record - Locking Information";
}
else if (ext == ".dbf" || ext == ".DBF")
{
ext = "DBF File";
}
else if (ext == ".xml" || ext == ".XML")
{
ext = "XML Document";
}
else if (ext == ".csv" || ext == ".CSV")
{
ext = "Microsoft Excel Comma Separated Values File";
}
else if (ext == ".CTL" || ext == ".ctl")
{
ext = "CTL File";
}
else if (ext == ".eds" || ext == ".EDS")
{
ext = "EDS File";
}
else if (ext == ".dts" || ext == ".DTS")
{
ext = "DTS File";
}
else if (ext == ".gfx" || ext == ".GFX")
{
ext = "GFX File";
}
else if (ext == ".pdf" || ext == ".PDF")
{
ext = "PDF File";
}
else if (ext == ".lnk" || ext == ".LNK")
{
ext = "LNK File";
}
else if (ext == ".txt" || ext == ".TXT")
{
ext = "TEXT File";
}
else if (ext == ".exe" || ext == ".EXE")
{
ext = "EXE File";
}
else if (ext == ".log" || ext == ".LOG")
{
ext = "LOG File";
}
else if (ext == ".dll" || ext == ".DLL")
{
ext = "DLL File";
}
else if (ext == ".gpd" || ext == ".GDP")
{
ext = "GPD File";
}
else if (ext == ".ppd" || ext == ".PPD")
{
ext = "PPD File";
}
else if (ext == ".prt" || ext == ".RPT")
{
ext = "PRT File";
}
else if (ext == ".dat" || ext == ".DAT")
{
ext = "DAT File";
}
else if (ext == ".ini" || ext == ".INI")
{
ext = "INI File";
}
else if (ext == ".tab" || ext == ".TAB")
{
ext = "TAB File";
}
else if (ext == ".rtp" || ext == ".RPT")
{
ext = "RPT File";
}
else if (ext == ".ZPP" || ext == ".zpp")
{
ext = "ZPP File";
}
else if (ext == ".BLD" || ext == ".sld")
{
ext = "BLD File";
}
else if (ext == ".zip" || ext == ".ZIP")
{
ext = "ZIP File";
}
else if (ext == ".cmp" || ext == ".CMP")
{
ext = "CMP File";
}
else if (ext == ".zrt" || ext == ".ZRT")
{
ext = "ZRT File";
}
else if (ext == ".rdl" || ext == ".RDL")
{
ext = "RDL File";
}
else if (ext == ".data")
{
ext = "DATA File";
}
else if (ext == ".DBI" || ext == ".dbi")
{
ext = "DBI File";
}
else if (ext == "")
{
ext = "File";
}
else if (ext == ".rpt" || ext == ".RPT")
{
ext = "RPT File";
}
else if (ext == ".rsv" || ext == ".RSV")
{
ext = "RSV File";
}
else if (ext == ".pfe" || ext == ".PFE")
{
ext = "PFE File";
}
else if (ext == ".sec" || ext == ".SEC")
{
ext = "SEC File";
}
else if (ext == ".als" || ext == ".ALS")
{
ext = "SEC File";
}
else if (ext == ".act" || ext == ".ACT")
{
ext = "ACT File";
}
else if (ext == ".mdb" || ext == ".MDB")
{
ext = "Microsoft Access Database";
}
else if (ext == ".csv" || ext == ".CSV")
{
ext = "Microsoft Excel";
}
else if (ext == ".vba" || ext == ".VBA")
{
ext = "VBA File";
}
else if (ext == ".ARS" || ext == ".ars")
{
ext = "ARS File";
}
else if (ext == ".AML" || ext == ".aml")
{
ext = "AML File";
}
else if (ext == ".rsv" || ext == ".RVS")
{
ext = "RVS File";
}
else if (ext == ".ARX" || ext == ".arx")
{
ext = "ARX File";
}
else if (ext == ".ARS" || ext == ".ars")
{
ext = "ARS File";
}
else if (ext == ".BIN" || ext == ".bin")
{
ext = "BIN File";
}
else if (ext == ".REE" || ext == ".ree")
{
ext = "REE File";
}
else if (ext == ".idx" || ext == ".IDX")
{
ext = "SQL Server Replication Snapshot Index Script";
}
else if (ext == ".CEL" || ext == ".CEL")
{
ext = "CEL File";
}
else if (ext == ".tmp" || ext == ".TMP")
{
ext = "TEP File";
}
else if (ext == ".ARI" || ext == ".ari")
{
ext = "ARI File";
}
else if (ext == ".ldf" || ext == ".LDF")
{
ext = "SQL Server Database Transaction Log File";
}
else if (ext == ".mdf" || ext == ".MDF")
{
ext = "SQL Server Database Primary Data File";
}
else if (ext == ".bak" || ext == ".BAK")
{
ext = "BAK File";
}
else if (ext == ".mdb" || ext == ".MDB")
{
ext = "Microsoft Access Database";
}
else if (ext == ".LDB")
{
ext = "Microsoft Access Record - Locking Information";
}
else if (ext == ".xlsx" || ext == ".xltx" || ext == ".xlt")
{
ext = "Microsoft Excel Worksheet";
}
string qry = "insert into eMAAS_Tbl_DirFileInfo (FileNames,Ext) values('" + name.Replace("'", "`").Trim() + "','" + ext.Trim() + "')";
SqlCommand SqlCom = new SqlCommand(qry, CN);
CN.Open();
SqlCom.ExecuteNonQuery();
CN.Close();
}
Label2.Text = "Successfully..";
TextBox1.Text = "";
Label2.Visible = true;
}
protected void Button3_Click(object sender, EventArgs e)
{
string qry = "truncate table eMAAS_Tbl_DirFileInfo";
SqlCommand SqlCom = new SqlCommand(qry, CN);
CN.Open();
SqlCom.ExecuteNonQuery();
CN.Close();
}
}
using System.Collections.Generic;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Default3 : System.Web.UI.Page
{
SqlConnection CN = new SqlConnection(@"SERVER=172.29.57.158\sql2012;Database=eMAAS;User ID=sa;Password=Mind1234");
protected void Page_Load(object sender, EventArgs e)
{
Label2.Visible = false;
}
protected void Button1_Click(object sender, EventArgs e)
{
string ext;
string[] allfiles = System.IO.Directory.GetFiles(TextBox1.Text, "*.*", System.IO.SearchOption.AllDirectories);
foreach (var file in allfiles)
{
FileInfo info = new FileInfo(file);
string name = info.Name.ToString();
ext =info.Extension.ToString();
if (ext == ".ldb" || ext == ".LDB")
{
ext = "Microsoft Access Record - Locking Information";
}
else if (ext == ".dbf" || ext == ".DBF")
{
ext = "DBF File";
}
else if (ext == ".xml" || ext == ".XML")
{
ext = "XML Document";
}
else if (ext == ".csv" || ext == ".CSV")
{
ext = "Microsoft Excel Comma Separated Values File";
}
else if (ext == ".CTL" || ext == ".ctl")
{
ext = "CTL File";
}
else if (ext == ".eds" || ext == ".EDS")
{
ext = "EDS File";
}
else if (ext == ".dts" || ext == ".DTS")
{
ext = "DTS File";
}
else if (ext == ".gfx" || ext == ".GFX")
{
ext = "GFX File";
}
else if (ext == ".pdf" || ext == ".PDF")
{
ext = "PDF File";
}
else if (ext == ".lnk" || ext == ".LNK")
{
ext = "LNK File";
}
else if (ext == ".txt" || ext == ".TXT")
{
ext = "TEXT File";
}
else if (ext == ".exe" || ext == ".EXE")
{
ext = "EXE File";
}
else if (ext == ".log" || ext == ".LOG")
{
ext = "LOG File";
}
else if (ext == ".dll" || ext == ".DLL")
{
ext = "DLL File";
}
else if (ext == ".gpd" || ext == ".GDP")
{
ext = "GPD File";
}
else if (ext == ".ppd" || ext == ".PPD")
{
ext = "PPD File";
}
else if (ext == ".prt" || ext == ".RPT")
{
ext = "PRT File";
}
else if (ext == ".dat" || ext == ".DAT")
{
ext = "DAT File";
}
else if (ext == ".ini" || ext == ".INI")
{
ext = "INI File";
}
else if (ext == ".tab" || ext == ".TAB")
{
ext = "TAB File";
}
else if (ext == ".rtp" || ext == ".RPT")
{
ext = "RPT File";
}
else if (ext == ".ZPP" || ext == ".zpp")
{
ext = "ZPP File";
}
else if (ext == ".BLD" || ext == ".sld")
{
ext = "BLD File";
}
else if (ext == ".zip" || ext == ".ZIP")
{
ext = "ZIP File";
}
else if (ext == ".cmp" || ext == ".CMP")
{
ext = "CMP File";
}
else if (ext == ".zrt" || ext == ".ZRT")
{
ext = "ZRT File";
}
else if (ext == ".rdl" || ext == ".RDL")
{
ext = "RDL File";
}
else if (ext == ".data")
{
ext = "DATA File";
}
else if (ext == ".DBI" || ext == ".dbi")
{
ext = "DBI File";
}
else if (ext == "")
{
ext = "File";
}
else if (ext == ".rpt" || ext == ".RPT")
{
ext = "RPT File";
}
else if (ext == ".rsv" || ext == ".RSV")
{
ext = "RSV File";
}
else if (ext == ".pfe" || ext == ".PFE")
{
ext = "PFE File";
}
else if (ext == ".sec" || ext == ".SEC")
{
ext = "SEC File";
}
else if (ext == ".als" || ext == ".ALS")
{
ext = "SEC File";
}
else if (ext == ".act" || ext == ".ACT")
{
ext = "ACT File";
}
else if (ext == ".mdb" || ext == ".MDB")
{
ext = "Microsoft Access Database";
}
else if (ext == ".csv" || ext == ".CSV")
{
ext = "Microsoft Excel";
}
else if (ext == ".vba" || ext == ".VBA")
{
ext = "VBA File";
}
else if (ext == ".ARS" || ext == ".ars")
{
ext = "ARS File";
}
else if (ext == ".AML" || ext == ".aml")
{
ext = "AML File";
}
else if (ext == ".rsv" || ext == ".RVS")
{
ext = "RVS File";
}
else if (ext == ".ARX" || ext == ".arx")
{
ext = "ARX File";
}
else if (ext == ".ARS" || ext == ".ars")
{
ext = "ARS File";
}
else if (ext == ".BIN" || ext == ".bin")
{
ext = "BIN File";
}
else if (ext == ".REE" || ext == ".ree")
{
ext = "REE File";
}
else if (ext == ".idx" || ext == ".IDX")
{
ext = "SQL Server Replication Snapshot Index Script";
}
else if (ext == ".CEL" || ext == ".CEL")
{
ext = "CEL File";
}
else if (ext == ".tmp" || ext == ".TMP")
{
ext = "TEP File";
}
else if (ext == ".ARI" || ext == ".ari")
{
ext = "ARI File";
}
else if (ext == ".ldf" || ext == ".LDF")
{
ext = "SQL Server Database Transaction Log File";
}
else if (ext == ".mdf" || ext == ".MDF")
{
ext = "SQL Server Database Primary Data File";
}
else if (ext == ".bak" || ext == ".BAK")
{
ext = "BAK File";
}
else if (ext == ".mdb" || ext == ".MDB")
{
ext = "Microsoft Access Database";
}
else if (ext == ".LDB")
{
ext = "Microsoft Access Record - Locking Information";
}
else if (ext == ".xlsx" || ext == ".xltx" || ext == ".xlt")
{
ext = "Microsoft Excel Worksheet";
}
string qry = "insert into eMAAS_Tbl_DirFileInfo (FileNames,Ext) values('" + name.Replace("'", "`").Trim() + "','" + ext.Trim() + "')";
SqlCommand SqlCom = new SqlCommand(qry, CN);
CN.Open();
SqlCom.ExecuteNonQuery();
CN.Close();
}
Label2.Text = "Successfully..";
TextBox1.Text = "";
Label2.Visible = true;
}
protected void Button3_Click(object sender, EventArgs e)
{
string qry = "truncate table eMAAS_Tbl_DirFileInfo";
SqlCommand SqlCom = new SqlCommand(qry, CN);
CN.Open();
SqlCom.ExecuteNonQuery();
CN.Close();
}
}
No comments:
Post a Comment